How do you check the value of a Transaction CustomField

Hi

How do you check the value of a Transaction CustomField?

im looking to create a script that will check a CF on the ticket transaction
and if it equals “Alert” it will set a Ticket CF to the same value.

This is to allow our in the field support teams to more easily highlight
tickets to our main support team and to give a descrition of the issue.

View this message in context: http://requesttracker.8502.n7.nabble.com/How-do-you-check-the-value-of-a-Transaction-CustomField-tp54509.html

How do you check the value of a Transaction CustomField?

Same way you would check it on a Ticket

$Ticket->FirstCustomFieldValue(‘Foo’);
$Transaction->FirstCustomFieldValue(‘Foo’);

FirstCustomFieldValue is an RT::Record method intentionally, since it
means any Record class that supports Custom Fields can use it.

http://bestpractical.com/rt/docs/latest/RT/Record.html#FirstCustomFieldValue-FIELD

im looking to create a script that will check a CF on the ticket transaction
and if it equals “Alert” it will set a Ticket CF to the same value.

This is to allow our in the field support teams to more easily highlight
tickets to our main support team and to give a descrition of the issue.

You might just want to expose the Ticket CF on the Update page
instead, but either way will work.

You can see code for adding CFs to the Reply/Comment page in the
RT-Extension-MandatoryOnTransition extension on CPAN/github.

-kevin

Thank you for your quick response

Ok so i am now trying to create a custom condition for my script to detect
if the Transaction Custom Field (“Alert_Support_T”) has been set to “Alert”
the CF

however it is not triggering when i set the CF in the transaction to alert

any ideals where im going wrong

Custom Condition
my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;

if ($trans->Type eq ‘CustomField’)
{my $cf = new RT::CustomField($RT::SystemUser);
$cf->LoadByName(Queue => $trans->QueueObj->id,Name => “Alert_Support_T”);
return 0 unless $cf->id;

if ($trans->Field == $cf->id &&
$trans->NewValue eq “Alert”)
{
return 1;
}
}
return 0;

View this message in context: http://requesttracker.8502.n7.nabble.com/How-do-you-check-the-value-of-a-Transaction-CustomField-tp54509p54540.html

Just a note the above works for the Ticket Custom Field if i change the

$cf->LoadByName(Queue => $trans->QueueObj->id,Name => “Alert_Support_T”);
to
cf->LoadByName(Queue => $ticket->QueueObj->id,Name => “Alert_Support”);

View this message in context: http://requesttracker.8502.n7.nabble.com/How-do-you-check-the-value-of-a-Transaction-CustomField-tp54509p54541.html

Just a note the above works for the Ticket Custom Field if i change the

$cf->LoadByName(Queue => $trans->QueueObj->id,Name => “Alert_Support_T”);
to
cf->LoadByName(Queue => $ticket->QueueObj->id,Name => “Alert_Support”);

RT::CustomField->LoadByName only loads ticket CFs, no other types (for
historical reasons).

You’ll need to load it differently.

ah ok so that method wont work

what method can be used for Transaction CFs?

View this message in context: http://requesttracker.8502.n7.nabble.com/How-do-you-check-the-value-of-a-Transaction-CustomField-tp54509p54558.html