Populating a Custom Field from an Action

Hello,

I’ve really racked my brain with something that seems pretty simple in theory:

I have two queues (A and B). When a specific field is changed in Queue A, an action is triggered, which creates a ticket in Queue B. Part of the scrip is:

$TicketObj->Create( Queue => $queue, Subject => $subject, Parents => $TicketNumber);

I want to also include the value for a custom field in Queue B, using the same line of code. I’ve read that I can do that by passing CustomField- .

Ultimately, the call would look something like:

$TicketObj->Create( Queue => $queue, Subject => $subject, Parents => $TicketNumber, CustomField- => “Value”);

So, two questions:

  1.  Is this possible? Am I even close?
    
  2.  How would you get the CustomField ID that would replace the letter "n" in CustomField-<n>?
    

Are there any examples I can look at?

Thanks for any help you’re able to provide. I would really appreciate it.

Best,

Daniel…

I have two queues (A and B). When a specific field is changed in Queue A,
an action is triggered, which creates a ticket in Queue B. Part of the
scrip is:

$TicketObj->Create( Queue => $queue, Subject => $subject, Parents =>
$TicketNumber);

An easier way is to make a scrip like this:

Condition: OnQueueChangeFromaAToB (write it yourself ;))
Action: CreateTicket (a built in action)
Template: CreateTicketInB

You need to create thist template like this:

===Create-Ticket: B0
Parent: {$Tickets{“TOP”}->Id}
Queue: B
CF-FIXME: FIXME-value
Content: blahblah
ENDOFCONTENT

you can add many other fields/customfields in this template!

see: RT::Action::CreateTickets - RT 4.0.25 Documentation - Best Practical

$TicketObj->Create( Queue => $queue, Subject => $subject, Parents =>
$TicketNumber, CustomField- => “Value”);

should work also ( maybe qw(value) ).

  1.  How would you get the CustomField ID that would replace the letter
    

“n” in CustomField-?

my $CustomField = RT::CustomField->new( $session{CurrentUser} );
$CustomField->LoadByName ( Name => ‘n’, Queue => ‘B’ );
my $cf_id = $CustomField->id;

Easter-eggs Spécialiste GNU/Linux
44-46 rue de l’Ouest - 75014 Paris - France - Métro Gaité
Phone: +33 (0) 1 43 35 00 37 - Fax: +33 (0) 1 43 35 00 76
mailto:elacour@easter-eggs.com - http://www.easter-eggs.com

Hi,

Thank you so much for your response. One more question: when you say

Condition: OnQueueChangeFromaAToB (write it yourself ;))
Action: CreateTicket (a built in action)

Could I do that through the User Defined conditions and actions in the User Interface?

for the condition, yes, you have to write it as UserDefined.
for the action, it should be already there.

Easter-eggs Spécialiste GNU/Linux
44-46 rue de l’Ouest - 75014 Paris - France - Métro Gaité
Phone: +33 (0) 1 43 35 00 37 - Fax: +33 (0) 1 43 35 00 76
mailto:elacour@easter-eggs.com - http://www.easter-eggs.com

Thank you so much!-----Original Message-----
From: Emmanuel Lacour [mailto:elacour@easter-eggs.com]
Sent: Saturday, June 15, 2013 1:05 AM
To: Daniel Tinoco-Silva; rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Populating a Custom Field from an Action

On 14/06/2013 20:32, Daniel Tinoco-Silva wrote:

Hi,

Thank you so much for your response. One more question: when you say

Condition: OnQueueChangeFromaAToB (write it yourself ;))
Action: CreateTicket (a built in action)

Could I do that through the User Defined conditions and actions in the User Interface?

for the condition, yes, you have to write it as UserDefined.
for the action, it should be already there.

Easter-eggs Spécialiste GNU/Linux
44-46 rue de l’Ouest - 75014 Paris - France - Métro Gaité
Phone: +33 (0) 1 43 35 00 37 - Fax: +33 (0) 1 43 35 00 76
mailto:elacour@easter-eggs.com - http://www.easter-eggs.com