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
I would do something like this , although I’m sure there are more elegant
I added more than you would need to accomplish it to show how to get at
I use this in the Custom Action Cleanup with an On Transaction Scrip
Hope this helps,
#Define the Custom Field Names Were Going to Play with.
my $CFName = 'Location Name;
my $CFToChange = ‘Address’;
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);