Re: [rt-users] Scrip for adding to the custom field based on another CF

2015-01-21 Thread Landon Stewart
On Jan 21, 2015, at 7:07 AM, Kevin Squire gentg...@wikiak.org wrote: I have a scrip currently that checks for status change from X-- Y and if true, adds an entry to the Custom Field RMA Num. It adds our RMA number, which is really just RMA-$RT_Ticket_Number They have asked me to

Re: [rt-users] Scrip for adding to the custom field based on another CF

2015-01-21 Thread Alex Peters
You should move your scrip code from the Prepare box to the Commit box. Making changes to tickets in the Prepare stage of a transaction can cause unintended side effects and is not recommended. On Thu, 22 Jan 2015 2:07 am Kevin Squire gentg...@wikiak.org wrote: I have a scrip currently that

Re: [rt-users] Scrip for adding to the custom field based on another CF

2015-01-21 Thread Kevin Squire
I was not aware of this. When you say Commit box, are you referring to the Custom action cleanup code box? On Wed, 21 Jan 2015 21:35:47 + Alex Peters a...@peters.net wrote: You should move your scrip code from the Prepare box to the Commit box. Making changes to tickets in the Prepare

Re: [rt-users] Scrip for adding to the custom field based on another CF

2015-01-21 Thread Alex Peters
Sorry, yes, that one. There are some preview operations that run the prepare code on the assumption that nothing will change. In such circumstances, your custom field would be set even before someone hits the Update button. It's always best not to have the Prepare code make any changes. The

Re: [rt-users] Scrip for adding to the custom field based on another CF

2015-01-21 Thread Kevin Squire
Such an elegant solution - thank you. This can be done with one ternary operator: my $value = $self-TicketObj-FirstCustomFieldValue('RMA Type') eq 'Student Withdrawl' ? RMA- . $Num : RMA- . $Num . $Append; Some notes: - The condition here is: $self-TicketObj-FirstCustomFieldValue('RMA