cancel change

kunal16
Tera Expert

As an OOB configuration, we have a UI action 'Cancel Change' that cancels a change request. This UI action will be visible to all the ITIL users.

I want to restrict the visibility conditions of this UI action such that it should be visible only

1. to requested by users

2. at states New(-5), Assess(-4), Authorize(-3) and Scheduled(-2).

I tried to update the condition but of no use.

gs.hasRole('itil') && (gs.getUserID() == requested_by) && ((current.state == -5) || (current.state == '-4') || (current.state == '-3') || (current.state == '-2')) && new ChangeRequestStateHandler(current).canMoveTo("canceled")

Kindly help.

Thanks in advance!!

1 ACCEPTED SOLUTION

Mihir Mohanta
Kilo Sage

Try below condition



gs.hasRole('itil') && (current.requested_by== gs.getUserID()) && ((current.state == '-5') || (current.state == '-4') || (current.state == '-3') || (current.state == '-2')) && new ChangeRequestStateHandler(current).canMoveTo("canceled")




Thanks,


Mihir


View solution in original post

10 REPLIES 10

rajmasurkar
Giga Guru

Hi,



Should it be visible to itil users too? If yes, should the requester have an itil role?




Raj


As an OOB feature, change requests can be only accessible to users having ITIL role. So by default requested by will have an ITIL role.


Hi,



It is good to know that you have knowledge about the process, but I was asking about your requirement.




Raj


Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

So, if I get your correct, then button should only show if the user is the one requested the change and the change need to be in one of your state



Then this should work:


gs.getUserID() == requested_by && (current.state == -5 || current.state == '-4' || current.state == '-3' || current.state == '-2')



//Göran