Cancel Chang

surajkumar95
Tera Contributor

I have this story to develop in Australia version; I need to inactive the ootb UI action and create a custom one for this requirement, also wanted to use the ootb mandatory cancellation reason prompt.

surajkumar95_0-1782923760234.png

is it possible directly from the UI action without creating a script include. Can someone please provide a solution for this.

1 REPLY 1

Tanushree Maiti
Tera Patron

Hi @surajkumar95 

 

Try this:

 

  1. Make Cancellation Reason Mandatory

you can use a UI policy to make the Closure notes or a specific Reason field mandatory whenever the state changes to Canceled.

  • Table: Change Request [change_request]
  • Condition: State is Canceled
  • UI Policy Actions: Set Closure notes (or your custom Cancellation reason field) to Mandatory = true and Visible = true.

 

 

 

  1. To ensure users only see the "Cancel" button based on your specified roles and states, modify the conditions on the OOB Cancel Change UI Action:

Name: Cancel Change
Table: Change Request
Form button: Checked

Condition (Paste this into the Condition field):

 

 

new ChangeRequestStateHandler().isCancelAllowed(current) || (current.type == 'normal' && (gs.getUser().isMemberOf(current.assignment_group) && (current.state == 'new' || current.state == 'assess' || current.state == 'authorize' || current.state == 'scheduled') || gs.hasRole('change_manager'))) || (current.type == 'standard' && (gs.getUser().isMemberOf(current.assignmentgroup) && (current.state == 'new' || current.state == 'assess' || current.state == 'authorize' || current.state == 'scheduled') || gs.hasRole('change_manager'))) || (current.type == 'emergency' && (gs.getUser().isMemberOf(current.assignmentgroup) && (current.state == 'new' || current.state == 'assess' || current.state == 'authorize' || current.state == 'scheduled') || gs.hasRole('change_manager') || gs.hasRole('major_incident_manager')))

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti