<div dir="ltr"><div class="gmail_extra">Sorry, hit the wrong button and sent early...
</div><div class="gmail_extra"><br></div><div class="gmail_extra"><span style="font-family:arial,sans-serif;font-size:13px">Hello,</span><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">I want to write a custom script at OnCreate that sets the subject of the new Ticket. </div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Our Subject format starts with:</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">YYYY-MM-XXXX: [TEXT] where YY is the year, MM is the month, and XXXX is a incrementing number.</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">So in pseudo code, I would like to say</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">(y,m,d) = getDate(Y-m-d).split('-')</div><div style="font-family:arial,sans-serif;font-size:13px">last_ticket_subj = last_created_ticket().split(':')[0]</div><div style="font-family:arial,sans-serif;font-size:13px">(ly,lm,lx) = split('-')</div><div style="font-family:arial,sans-serif;font-size:13px">if (y==ly AND m==lm):</div><div style="font-family:arial,sans-serif;font-size:13px"> newx = (int)lx + 1</div><div style="font-family:arial,sans-serif;font-size:13px"> self->Ticket->subject = "y-m-newx:"</div><div style="font-family:arial,sans-serif;font-size:13px">else</div><div style="font-family:arial,sans-serif;font-size:13px"> self->Ticket->subject = "y-m-0001:</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">I know that this is not functional code but I think it gets the point across. How do I get the last ticket subject out of RT and how do I set the new tickets subject?</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Thanks for your help and sorry for the two emails.</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div></div></div>