Approval field not updated on request cancellation

Wade Clairmont
Tera Guru

Hey all,

We are starting to run reports on requests that have been cancelled, but noticed an issue on the OOB cancel request UI action.

When you cancel the request, the workflow is cancelled, the RITMs are cancelled, task as well, however, even tho the request state is "closed cancelled', the request.approval field is still set to "requested".   I have tried to update the UI action that sets the request_state, but am unable to update the approval field to a custom value of "cancelled" as well.

Is there an ACL or rule somewhere that prevents me from setting that field to "cancelled?"

I can change the active state and pretty much everything else on cancellation, however, just not that field.

Any thoughts?

Thanks in advance.

3 REPLIES 3

johnolivermendo
ServiceNow Employee
ServiceNow Employee

Hey Wade,



Can I see the script that you're using to set the request.approval field?



I'm wondering if the issue is simply that you are setting the request.approval field to a value that does not exist for that field. Right click the 'Approval' field on the Request form and click 'Configure Choices'.


Screen Shot 2017-06-28 at 2.22.50 PM.png



*Note: You can go to 'Show Choice List' to see all of the choice list values related to 'approval', although they all won't be used for the sc_request.approval field.



You'll see the choice values for the field.


Screen Shot 2017-06-28 at 2.23.35 PM.png



Unfortunately the value 'cancelled' is not a value for sc_request.approval. The 'cancelled' value that you probably see in the dictionary refers to a different table called Group Approval.


Screen Shot 2017-06-28 at 2.40.05 PM.png



Regardless, the OOB behavior of the 'Cancel Request' UI Action leaving the sc_request.approval value as 'Requested' is justified since the field right under it 'Request state' says 'Closed Cancelled'.




Solution:



But If you really want to set your approval field value to 'Cancelled', then simply add it in the Configure Choice page. It would just be for show though.



After you create your new choice field called 'Cancelled', right click the Approval field, go to 'Show Choice List'   make sure to set the value to 'cancelled' and label as 'Cancelled' as shown below.


Screen Shot 2017-06-28 at 2.52.03 PM.png


Then your UI Action script can simply be:


current.request_state = 'closed_cancelled';


current.stage = 'closed_complete';


current.approval = 'cancelled';


current.update();



Let me know if that works for you.


Here are my choices


Request.Approval choices.pngRequest.Approval config.png



And here is the UI Script:


Cancel Request.png



Thanks again


And here are the results


request UI results.png