I would like to trigger an approval request with a custom field value.
We have set up approvals normally which work great, but we wanted to be able to set a custom field value to trigger the creation instead.
We have a custom field called “Needs Approval” and we have a scrip with the custom condition:
my $Ticket = $self->TicketObj;
return 0 unless $self->TicketObj->FirstCustomFieldValue(‘65’) eq ‘Yes’;
Prep code and Commit code are blank. Action is “Create tickets” and Template “Create Approval Request” as normal.
This all works fine initially but because the “Needs Approval” field remains set to “Yes” then every time the ticket is touched another approval gets created. So I am trying to unset “Needs Approval” from “Yes” to “No” after it’s been triggered.
I have tried this in the Commit code (prep code blank):
$cf->LoadByName( Name => ‘Needs Approval’ );
$self->TicketObj->AddCustomFieldValue( Field => ‘$cf’, Value => ‘No’ );
But it doesn’t seem to work.
Any advice or help appreciated as always.
Far Edge Technology
p. 02 84251400