Transfer custom field value in ticket creation

Someone have any idea abaout how to transfer a custom field value?, when you create a new ticket from another, as for example create a Incident from Incident Report, but instead of selecting it again values for custom field in the Incident use the Report ones.

Juan Ramón Alfageme Mata. Soporte ICM +34 91 787 23 00

Someone have any idea abaout how to transfer a custom field value?, when you create a new ticket from another, as for example create a
Incident from Incident Report, but instead of selecting it again values for custom field in the Incident use the Report ones.

You can do it by developing an scrip, but we need to have some reference to the “source ticket” (the ticket which have the custom fields we want). Supose the situation:

  • We want to copy custom field values of CF1;

  • Ticket A (Incident Report) - Have the custom field values we want to copy;

  • Ticket B (Incident) - The just created ticket;

The queues must have the same custom fields (or just with equal names)

  • Ticket B REFERS TO Ticket A;

Scrip:
Queue: Incident
Stage: TransactionCreate
Condition: OnCreate
Action: User Defined:
Custom Prepare Code:
return 1;

Custom Commit code:

Reaching the referred ticket by the links

my $Reference = $self->TicketObj->RefersTo->Next;
my $SourceTicket = $Reference->TargetObj if ($Reference);

we get the custom fields

my $CF1Values = $SourceTicket->CustomFieldValues (‘CF1’);

while (my $CurrValue = $CF1Values->Next) {
$self->TicketObj->AddCustomFieldValue (Field => ‘CF1’, Value => $CurrValue->Content);
}

return 1;

I think that’s all!

Regards,

Lucas F. Rosada
lucas@dextra.com.br

Dextra Sistemas
+55 (19) 3256 6722
http://www.dextra.com.br

It’s a global CustomField named “Customer” we use it in RTIR queues, the idea is trasfer the value from the Report to Incident, Investigations and Blocks, because find it in a large list for every ticket is very time consuming.

I tried the scrip, but doesn’t work.

Thanks.

Juan Ramón Alfageme Mata
+34 91 787 23 00 alhambra-eidos.comDate: Thu, 10 Mar 2005 15:02:19 -0300
From: “Lucas F. Rosada” lucas@dextra.com.br
Subject: [Rt-devel] Re: Transfer custom field value in ticket creation
To: rt-devel@lists.bestpractical.com
Message-ID: 42308BAB.1000602@dextra.com.br
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Someone have any idea abaout how to transfer a custom field value?, when you create a new ticket from another, as for example create a
Incident from Incident Report, but instead of selecting it again values for custom field in the Incident use the Report ones.

You can do it by developing an scrip, but we need to have some reference to the “source ticket” (the ticket which have the custom fields we want). Supose the situation:

  • We want to copy custom field values of CF1;

  • Ticket A (Incident Report) - Have the custom field values we want to copy;

  • Ticket B (Incident) - The just created ticket;

The queues must have the same custom fields (or just with equal names)

  • Ticket B REFERS TO Ticket A;

Scrip:
Queue: Incident
Stage: TransactionCreate
Condition: OnCreate
Action: User Defined:
Custom Prepare Code:
return 1;

Custom Commit code:

Reaching the referred ticket by the links

my $Reference = $self->TicketObj->RefersTo->Next;
my $SourceTicket = $Reference->TargetObj if ($Reference);

we get the custom fields

my $CF1Values = $SourceTicket->CustomFieldValues (‘CF1’);

while (my $CurrValue = $CF1Values->Next) {
$self->TicketObj->AddCustomFieldValue (Field => ‘CF1’, Value => $CurrValue->Content);
}

return 1;

I think that’s all!

Regards,

Lucas F. Rosada
lucas@dextra.com.br

Dextra Sistemas
+55 (19) 3256 6722
http://www.dextra.com.br

Still not work but I think that must be “BaseObj” instead of “TargetObj” because link base is Report and link target is the Incident.

my $SourceTicket = $Reference->TargetObj if ($Reference);

Fixed:

my $SourceTicket = $Reference->BaseObj if ($Reference);

Juan Ramón Alfageme Mata
+34 91 787 23 00 alhambra-eidos.com

Message: 1Date: Thu, 10 Mar 2005 15:02:19 -0300
From: “Lucas F. Rosada” lucas@dextra.com.br
Subject: [Rt-devel] Re: Transfer custom field value in ticket creation
To: rt-devel@lists.bestpractical.com
Message-ID: 42308BAB.1000602@dextra.com.br
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Someone have any idea abaout how to transfer a custom field value?, when you create a new ticket from another, as for example create a
Incident from Incident Report, but instead of selecting it again values for custom field in the Incident use the Report ones.

You can do it by developing an scrip, but we need to have some reference to the “source ticket” (the ticket which have the custom fields we want). Supose the situation:

  • We want to copy custom field values of CF1;

  • Ticket A (Incident Report) - Have the custom field values we want to copy;

  • Ticket B (Incident) - The just created ticket;

The queues must have the same custom fields (or just with equal names)

  • Ticket B REFERS TO Ticket A;

Scrip:
Queue: Incident
Stage: TransactionCreate
Condition: OnCreate
Action: User Defined:
Custom Prepare Code:
return 1;

Custom Commit code:

Reaching the referred ticket by the links

my $Reference = $self->TicketObj->RefersTo->Next;
my $SourceTicket = $Reference->TargetObj if ($Reference);

we get the custom fields

my $CF1Values = $SourceTicket->CustomFieldValues (‘CF1’);

while (my $CurrValue = $CF1Values->Next) {
$self->TicketObj->AddCustomFieldValue (Field => ‘CF1’, Value => $CurrValue->Content);
}

return 1;

I think that’s all!

Regards,

Lucas F. Rosada
lucas@dextra.com.br

Dextra Sistemas
+55 (19) 3256 6722
http://www.dextra.com.br

Now I’m trying the following commit code:

my $CFName = ‘CustomField1’;

my $Reference = $self->TicketObj->ReferredToBy->Next;
my $SourceTicket = $Reference->BaseObj;

my $CF1Values = $SourceTicket->CustomFieldValues($CFName);

while (my $CurrValue = $CF1Values->Next) {
my( $st, $msg ) = $self->TicketObj->AddCustomFieldValue (Field => $CFName, Value => $CurrValue->Content);
}

return 1;

But doesn’t work, any suggestion?

Juan Ramón Alfageme Mata
+34 91 787 23 00 alhambra-eidos.com