Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Remove Approve Button in List Context Menu

gdk
Kilo Contributor

Hi All,

I want to hide/remove the Approve button in List Context Menu when the State is No Longer required and also for particular approval_admin user.

I have given the condition:

cuurent.state == 'requested' && gs.hasRole('approval_admin')   (With this Condition, The Approve Button should only be visible when the State is Requested)

But I see Approve button Option in List Context Menu after the State has changed to No Longer Required.

I have seen several questions on this issue in the Community but I did not find any luck in solving the issue. I would really appreciate if someone gives a right answer.

Thanks,

GK

5 REPLIES 5

bernyalvarado
Mega Sage

Hi GK,



Which UI action have you tried to customize? Have you tried changing the following one:


yourinstanceurl/nav_to.do?uri=sys_ui_action.do?sys_id=845b8667c611227d01a264f153aaf953


Thanks,


Berny


That is exactly what I was looking for.  Thank you.

PS: I modified the condition to include

current.source_table!="dmn_demand"

This will show the Approve option on the context menu, but will pop up the following message if you right click on a demand: "Security does not allow the execution of that action against the specified record"

Viswanatha Red3
Mega Expert

Hi,



I have observed that OOB, servicenow defined three Approve UI actions on "sysapproval_approver" table.


Add the "cuurent.state == 'requested' " conditions in all the UI action records and observe.


find_real_file.png


I have tried in my own instance and it worked.



Regards


Viswa



Thanks Viswanath for your response.


I tried the same condition for the three Approvers you are talking about. Except for List Context Menu, the other two Approver (Form Button, List Choice) are working. I do not why it is not hiding for List Context Menu.



Yes Berny, I did and I am facing problem only with the List Context Menu approver