[rt-users] Copy value of one custom field to another
Laura Grella
lgrella at acquiremedia.com
Tue Jun 24 12:25:00 EDT 2008
I have one custom field (customer) which is mandatory for a certain queue
(customer support). I don't want this field mandatory in all queues, but I
want all queues to be able to search on it. The only way I was able to get
around this was to create a second custom field and make it a global field,
and users can see it but can't modify it. I am writing a scrip in the
customer support queue that will copy the mandatory custom field into the
global one. It is not working and is always empty. Here is the code. Does
anyone see anything wrong?
Condition: On Create
Action: User Defined
Template: Blank
Stage: TransactionCreate
Custom action preparation code: return 1;
Custom action cleanup code:
#Define the Custom Field Names we are going to take from and write to.
my $CFNameFrom = 'Customer;
my $CFNameTo = 'GlobalCustomer';
#Transaction Association
my $txnObj = $self->TransactionObj;
my $ticketObj = $self->TicketObj;
my $queueObj = $self->TicketObj->QueueObj;
my $CFObj = RT::CustomField->new($RT::SystemUser);
my $CFNewObj = RT::CustomField->new($RT::SystemUser);
#Grab the Custom Field we're using for the switch.
$CFObj->LoadByNameAndQueue(Name => $CFNameFrom, Queue => $queueObj->id);
#Grab the Custom Field we want to set.
$CFNewObj->LoadByNameAndQueue(Name => $CFNameTo, Queue => $queueObj->id);
my $cfValue = $ticketObj->FirstCustomFieldValue($CFNameFrom);
my ($st, $msg) = $ticketObj->AddCustomFieldValue(
Field => $CFNewObj->id,
Value => $cfValue,
RecordTransaction => 1
);
--
View this message in context: http://www.nabble.com/Copy-value-of-one-custom-field-to-another-tp18094637p18094637.html
Sent from the Request Tracker - User mailing list archive at Nabble.com.
More information about the rt-users
mailing list