[rt-users] Assign Subject On Create

Kevin Holleran holleran.kevin at gmail.com
Fri Oct 3 13:38:31 EDT 2014


Sorry, hit the wrong button and sent early...

Hello,

I want to write a custom script at OnCreate that sets the subject of the
new Ticket.

Our Subject format starts with:

YYYY-MM-XXXX: [TEXT] where YY is the year, MM is the month, and XXXX is a
incrementing number.

So in pseudo code, I would like to say

(y,m,d) = getDate(Y-m-d).split('-')
last_ticket_subj = last_created_ticket().split(':')[0]
(ly,lm,lx) = split('-')
if (y==ly AND m==lm):
    newx = (int)lx + 1
    self->Ticket->subject = "y-m-newx:"
else
    self->Ticket->subject = "y-m-0001:


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?

Thanks for your help and sorry for the two emails.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20141003/d598679b/attachment.htm>


More information about the rt-users mailing list