<p dir="ltr">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.<br>
</p>
<br><div class="gmail_quote">On Thu, 22 Jan 2015 2:07 am Kevin Squire <<a href="mailto:gentgeen@wikiak.org">gentgeen@wikiak.org</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>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"</div><div><br></div><div>They have asked me to change the number based on another CF "RMA TYPE". If the RMA type = "Student Withdrawl" they want the RMA number to be appended with "WD"</div><div><br></div><div><br></div><div>My perl skills are limited to copy/paste and tweaking existing.... so I would like a little bit of help with my If/Then statement. The idea being:</div><div><br></div><div>IF CustomField{RMA Type} = Student Withdrawl</div><div>THEN $Append = "-WD"</div><div>ELSE $Append = "" </div><div><br></div><div>Then in the current line (below) </div><div> <span style="font-family:monospace,monospace">my $Value = "RMA-" . $Num ;</span></div><div><span style="font-family:monospace,monospace"><br></span></div><div><span style="font-family:monospace,monospace">would be changed to</span></div><div><span style="font-family:monospace,monospace"> m</span><span style="font-family:monospace,monospace">y $Value = "RMA-" . $Num . $Append ;</span></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><div><b>Custom action preparation code:</b></div><div><br></div><div><font face="monospace, monospace"># Define the Custom Field to Act on</font></div><div><font face="monospace, monospace">my $CFName = "RMA Num";</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">#Get the RT Ticket Number</font></div><div><font face="monospace, monospace">my $Num = $self->TicketObj->id();</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"># Define the desired value for the CF</font></div><div><font face="monospace, monospace">my $Value = "RMA-" . $Num ;</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">$self->TicketObj->AddCustomFieldValue( Field => $CFName, Value => $Value );</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">return 1;</font></div></div><div><br></div><div><br></div><div><br clear="all"><div><br></div>-- <br><div><a href="http://www.wikiak.org" target="_blank">http://www.wikiak.org</a><br><br>#############################################################<br> Associate yourself with men of good quality if you esteem <br> your own reputation; for 'tis better to be alone then in bad <br> company. - George Washington, Rules of Civility<br></div>
</div></div>
</blockquote></div>