[rt-users] Linking a Transaction CF value to a Ticket CF value

scott.dalzell scott.dalzell at aveva.com
Wed Jul 3 10:00:26 EDT 2013


I currently have 2 customfields assosated with my tickets. Both will be used
to highlight a ticket to our support team when set to 'Alert'.

Currently the CF on the ticket is used to updates the required tables and
notify support etc but having a CF on the Transaction would make it easyer
for the user to Alert support and give a description of the issue as many
times the user has forgoten to do this 

Ticket CF - 'Alert_Support'
Trans CF - 'Alert_Support_T'

what i want to do is to create a script that will detect when the
"Alert_Support_T" CF is updated to 'Alert' and then update the
"Alert_Support" CF to 'Alert' to allow all the aproprate tables to update to
highlight the ticket to the support team

I have been trying for serveral days to get this working but as im new to RT
i feel like im missing something straight foward

I currently have the following script

Descrition - ZZZ - Test Alert_Support_T trigger
Condition - User Defined
Action      - User Defined
Template - Global Template - Blank
Stage      - TransactionCreate

###Custom Conditions###

#Set my Variables
 my $trans = $self->TransactionObj;
 my $type = $trans->Type;

#Check CustomField on Create ticket
 if ( $type eq 'Create' ) {
     return 0 unless $trans->FirstCustomFieldValue('Alert_Support_T') eq
'Alert';
 } 

#check Customfield on ticket update
elsif ( $type eq 'CustomField' ) {
     # CF can be changed later
     my $cf = RT::CustomField->new( $self->CurrentUser );
     $cf->Load( $trans->Field );
     return 0 unless $cf->Name eq 'Alert_Support_T';
     return 0 unless $trans->NewValue eq 'Alert';
 } else {
     return 0;
 }
 return 1;


###Custom Action###

#Set my Variables
 my $ticket = $self->TicketObj;

#CODE - update CF
$ticket->AddCustomFieldValue( Field => 'Alert_Support', Value => 'Alert' );

return 1;

###Custom Action###

return 1;


i am under the impresion that the script is failing to trigger so i figure
there is an issue with the custom conditions but i cant figure out where

if you could give me any help on this issue it would be a great help

thank you



--
View this message in context: http://requesttracker.8502.n7.nabble.com/Linking-a-Transaction-CF-value-to-a-Ticket-CF-value-tp54546.html
Sent from the Request Tracker - User mailing list archive at Nabble.com.


More information about the rt-users mailing list