Does anyone have a code snippet for autofilling custom fields based on the
entries of other custom fields?
For instance say you have a custom field for Location Name: XXXX
Then address custom field would autfill based on the entry for Location
Name…
Jim
Does anyone have a code snippet for autofilling custom fields based on the
entries of other custom fields?
For instance say you have a custom field for Location Name: XXXX
Then address custom field would autfill based on the entry for Location
Name…
Jim
Jim,
I would do something like this , although I’m sure there are more elegant
solutions.
I added more than you would need to accomplish it to show how to get at
certain bits.
I use this in the Custom Action Cleanup with an On Transaction Scrip
Hope this helps,
Rodney
#Define the Custom Field Names Were Going to Play with.
my $CFName = 'Location Name;
my $CFToChange = ‘Address’;
#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 were using for the switch.
#We dont necessarily need this, but hey here it is…
$CFObj->LoadByNameAndQueue(Name => $CFName, Queue => $queueObj->id);