[rt-users] Custom fields in transaction

Nilesh me at nileshgr.com
Fri Jul 1 22:29:03 EDT 2016


Can you provide some example? 
On the wiki I saw some scrip which was testing the return value of
TransactionBatch method, but now after doing that I don't see the log. 

In custom action commit code:

my $batch = $self->TicketObj->TransactionBatch;
if($batch) {
RT::Logger->info("transaction batch");
RT::Logger->info("Field Value: " . $self->TransactionObj-
>FirstCustomFieldValue('Product'));
}

--
Nilesh

On 01-Jul-2016 10:52 pm, "Jim Brandt" <jbrandt at bestpractical.com>
wrote:

On 6/30/16 11:41 PM, Nilesh wrote:
> Hi,
> 
> I'm trying to assign the ticket to a queue based on a transaction
> custom field, but I am unable to fetch the custom field in my scrip.
> 
> Scrip details:
> Condition: On correspond
> Action: User defined
> Template: Blank
> 
> Custom condition:
> 1;
> 
> Custom action preparation code:
> 1;
> 
> Custom action commit code:
> my $queueName = $self->TicketObj->QueueObj->Name;
> RT::Logger->info("Queue name: $queueName");
> 
> my $trans = $self->TransactionObj;
> RT::Logger->info($trans->FirstCustomFieldValue("Product"));
> 
> ------------------
> 
> The method FirstCustomFieldValue returns empty even though the value
> is
> set in form submission.
> 
> All the stuff I found on Google are about custom fields in tickets,
> seems nobody uses transaction custom fields?
> 
> I'm using RT 4.4.0.
> 
> 
 
If you are submitting the value for Product in the same update, the On
Correspond transaction may run before the value is committed, so it's
not there yet. Try moving the scrip to Batch stage rather than Normal.
Batch runs at the end, so the value should be set.

---------
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016

-- 
Nilesh




More information about the rt-users mailing list