Hiding Approve/Reject based on approval state "Requested"

anto
Kilo Expert

Hi All,

We need to hide/remove the approve/reject when the state is not requested in approval record.

I have tried by giving current.state != 'requested' in OOB two list context menu UI action defined for sysapproval_approver table. But this is not helping. The "current" is not working in list context menu.

We can hide/remove by validating roles(gs.hasRoleExactly("zzz")), but we need to hide/remove it based on state of the approval record.

Is there any other way we can achieve this???

Thanks in advance.

Screen Shot 2016-06-08 at 10.50.02 AM.png

1 ACCEPTED SOLUTION

Hi All,



Thank you for your wonderful time.



Actually the "current" works in right click context menu. As am having the condition current.state == 'requested' on the UI action approve, the functionality   is supposed to hide the context menu "approve" whenever the state is not 'requested'. but instead of the its throwing a "security error" as "Security does not allow the execution of that action against the specified record".




Thanks,


Joshwa


View solution in original post

10 REPLIES 10

Dave Smith1
ServiceNow Employee
ServiceNow Employee

Bit late to the party, but...   is there a gs.hasRoleExactly() method?



I can't find documentation of it, and my experiments suggest it's a method of GlideUser but not GlideSystem.