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

Kevin Squire gentgeen at wikiak.org
Wed Jan 21 10:07:15 EST 2015


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 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"


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:

IF CustomField{RMA Type} = Student Withdrawl
THEN $Append = "-WD"
ELSE $Append = ""

Then in the current line (below)
             my $Value = "RMA-" . $Num ;

would be changed to
      my $Value = "RMA-" . $Num . $Append ;





*Custom action preparation code:*

# Define the Custom Field to Act on
my $CFName = "RMA Num";

#Get the RT Ticket Number
my $Num = $self->TicketObj->id();

# Define the desired value for the CF
my $Value = "RMA-" . $Num ;

$self->TicketObj->AddCustomFieldValue( Field => $CFName, Value => $Value );

return 1;




-- 
http://www.wikiak.org

#############################################################
 Associate yourself with men of good quality if you esteem
 your own reputation; for 'tis better to be alone then in bad
 company.        - George Washington, Rules of Civility
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20150121/0ace5d44/attachment.html>


More information about the rt-users mailing list