[rt-users] Adding a CustomField to a ticket?

Mahoney, Tim Tim.Mahoney at magicorp.com
Tue Oct 18 09:17:32 EDT 2005


 Here is a scrip we use to move tickets into a queue when they are created
based upon subject line.  RT doesn't show the ticket being moved, so I think
this scrip is actually causing the ticket to be created in the new queue.
See if this might work for you.

Description: AutoChange Queue
Condition: On Create
Custom condition:
Action: User Defined
Custom Action Preparation code: return 1;
Custom Action Cleanup code:  # get out unless subject is like ursuant
  return 1 unless $self->TicketObj->Subject =~ /ursuant/;

  # ok, try to change queue
  $RT::Logger->info("Auto transfer ticket #". $self->TicketObj->id ." to the
Pursuant Queue" );
  my ($status, $msg) = $self->TicketObj->SetQueue( '8' );
  unless( $status ) {
    $RT::Logger->warning( "Impossible to change Queue" );
    return undef;
  }
  return 1;
Stage: TransactionCreate
Template: Global template: Blank


Thanks,
Tim
972-980-4991

-----Original Message-----
From: Todd Chapman [mailto:todd at chaka.net] 
Sent: Tuesday, October 18, 2005 7:03 AM
To: Howard Jones
Cc: rt-users at lists.bestpractical.com
Subject: Re: [rt-users] Adding a CustomField to a ticket?

What is the scrip condition?

On Tue, Oct 18, 2005 at 10:51:04AM +0100, Howard Jones wrote:
> Hi,
> 
> I've been experimenting this morning with a scrip to extract 
> information from some fields in a ticket, and fill in some additional 
> information in a customfield, based on those fields. The scrip works, 
> but only if the ticket was created in the appropriate queue, and not moved
there.
> 
> Apparently, if it was moved into the queue, it doesn't gain the CFs 
> for that queue. Unfortunately, the way we have RT setup, almost all 
> mails go into General before being re-filed by us (we don't trust our 
> customers to categorise their problem, basically). Is there a way to 
> add a CF to a ticket from within a scrip, or alternatively, is there 
> something else I need to do to inherit a CF when the ticket moves?
> 
> My script action is currently:
> 
>   my $tick = $self->TicketObj;
>   my $requestor = $tick->RequestorAddresses;
>   my $cf = $tick->QueueObj->CustomField('OutageSource');
> 
>   if($requestor ne "")
>   {
>         $tick->DeleteWatcher(Type=>'Requestor',Email=>$requestor);
>         $tick->AddCustomFieldValue(Field=>$cf,Value=>$requestor);
>         $RT::Logger->warning("Removing requestor, adding CF value");
>    }
>    return 1;
> 
> I have a couple of similar but more involved scrips I was planning to 
> write, but obviously I'd like to get past this bit first!
> 
> Thanks in advance,
> 
> Howard
> 
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> 
> Be sure to check out the RT Wiki at http://wiki.bestpractical.com
> 
> Buy your copy of our new book, RT Essentials, today! 
> 
> Download a free sample chapter from http://rtbook.bestpractical.com
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Be sure to check out the RT Wiki at http://wiki.bestpractical.com

Buy your copy of our new book, RT Essentials, today! 

Download a free sample chapter from http://rtbook.bestpractical.com



More information about the rt-users mailing list