[Rt-devel] Re: Re: Transfer custom field value in ticket creation

Juan Ramón Alfageme Mata JRamon.Alfageme at alhambra-eidos.com
Wed Mar 16 04:00:47 EST 2005


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: 1
Date: Thu, 10 Mar 2005 15:02:19 -0300
From: "Lucas F. Rosada" <lucas at dextra.com.br>
Subject: [Rt-devel] Re: Transfer custom field value in ticket creation
To: rt-devel at lists.bestpractical.com
Message-ID: <42308BAB.1000602 at 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 at dextra.com.br

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




More information about the Rt-devel mailing list