Referencing a specific Custom Field in a script

We are trying to create a scrip that sets the Priority based on a custom field called “Severity”.
For example, if Severity = Urgent, the Priority should = 100.
Here is the script we are using. I have seen other posts of people using this syntax, but we simply cannot get it to work.

Condition: On Create
Action: User Defined
Custom action preparation code:
return 1;

Custom action cleanup code:
if ($self->TicketObj->FirstCustomFieldValue(‘Severity’) eq “Urgent”) {
$self->TicketObj->SetPriority( 100 );
return 1;
}

Stage: TransactionCreate
Template: Blank

It is definitely a problem with the custom field portion of the code… (the SetPriority part works fine if we get rid of the first line that references the custom field)
Any advise???

We are using RT 3.0.8rc1

Thanks in advance.

Terri Bendl
Network Administrator

Hi Terri,

how should this work? If you set this scrip to on Create, then you have not
defined the CF Value for Severity so far. How will the ticket created? Via
Mail or WebUI? If you have some more information, i can sent you some
working scrips from my installation, but i’m using now 3.6.1.

Torsten2006/8/17, Terri Bendl terri.bendl@ezpass.csc.paturnpike.com:

We are trying to create a scrip that sets the Priority based on a custom
field called “Severity”.
For example, if Severity = Urgent, the Priority should = 100.
Here is the script we are using. I have seen other posts of people using
this syntax, but we simply cannot get it to work.

Condition: On Create
Action: User Defined
Custom action preparation code:
return 1;

Custom action cleanup code:
if ($self->TicketObj->FirstCustomFieldValue(‘Severity’) eq “Urgent”) {
$self->TicketObj->SetPriority( 100 );
return 1;
}

Stage: TransactionCreate
Template: Blank

It is definitely a problem with the custom field portion of the code…
(the SetPriority part works fine if we get rid of the first line that
references the custom field)
Any advise???

We are using RT 3.0.8rc1

Thanks in advance.

Terri Bendl
Network Administrator


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

MFG

Torsten Brumm

http://www.torsten-brumm.de