[rt-users] Need help with custom field to trigger approvals (RT 4.2)
Dion Gullotta
Dion.Gullotta at faredge.com.au
Wed Oct 7 00:52:55 EDT 2015
Hi all,
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';
return 1;
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.
Thank you.
Dion Gullotta
Far Edge Technology
p. 02 84251400
http://www.faredge.com.au
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20151007/33010112/attachment.htm>
More information about the rt-users
mailing list