[rt-users] Problems with an SLA Scrip I created

David Hollinger david.hollinger at HWTears.com
Wed Jan 11 17:50:18 EST 2012


I've written a scrip to do not only that, but to change the SLA whenever the Priority is changed, based off what the priority is changed to, however it doesn't seem to work.  Here's the code - I'm fairly new to perl, so I may have missed something in the code:



my $ticketPriority = $self->TicketObj->Priority;

if($ticketPriority == 0) {

      my $SLA = '24';

      }

elsif($ticketPriority == 25) {

      my $SLA = '8';

      }

elsif($ticketPriority == 50) {

      my $SLA = '4';

      }

elsif($ticketPriority == 75) {

      my $SLA = '1';

      }

else {

      my $SLA = 'Critical';

      }



my $CFName = 'SLA';

my $CF = RT::CustomField->new( $RT::SystemUser ); $CF->LoadByNameAndQueue( Name => $CFName, Queue => $Ticket->Queue ); unless( $CF->id ) {

  $CF->LoadByNameAndQueue( Name => $CFName, Queue => '0' ); }

unless( $CF->id ) {

  $RT::Logger->error( "No field $CFName in queue ". $Ticket->QueueObj->Name );

  return undef;

}



$Ticket->AddCustomFieldValue ( Field => $CF, Value => $SLA );





Any suggestions or problems you see?

Thanks!

David Hollinger III
IT Infrastructure Coordinator
Handwriting Without Tears
(301)263-2700 ext 285
(402)430-3127

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20120111/d883540a/attachment.htm>


More information about the rt-users mailing list