Assign Subject On Create

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):

self->Ticket->subject = "y-m-0001:"

else
self->Ticket->subject = “y-m-0001:”

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.

I got this working but I just created a user in the DB that only has rights
to read the Subject & ID and worked from there.

Thanks.

Kevin Holleran
Master of Science, Computer Information Systems
Grand Valley State University
Master of Business Administration
Western Michigan University
CISSP, GISP, GXPN, GCFA, GCFE, PCIP, PCI ISA, Cisco CCNA, ICCP ISA,
Microsoft MCSA

“If you have responsibility for security, but no authority to make changes,
then you’re just there to take the blame when something goes wrong” Gene
Spafford - Spafford’s First Law of Security

“Do today what others won’t, do tomorrow what others can’t” - SEALFit

“We are what we repeatedly do. Excellence, then, is not an act, but a
habit.” - AristotleOn Fri, Oct 3, 2014 at 1:38 PM, Kevin Holleran holleran.kevin@gmail.com wrote:

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.