list context menu: use 'current' in the condition field

Adil JEBLI
Mega Expert

Hi everyone,

Im trying to creat a Ui action (list context menu), this gonna be apply for a related list in some form for example change_request and change_task, so when i right-click on some row in the related list i will see my ui action in that menu, i know that i can control its visibility by scripting in the condition field.

For example if i want to show it for users that have the role 'some_role' i have to write in the field condition this: gs.hasRole('some_role') .

I can also control visiblity by accessing to the parent that is 'change_request' in this case by typing 'parent' form example:'parent.active'.

but i can't access to the information row (record in the related list 'change_task') by typing the word 'current' as in the form button.

i read in the wiki this:

  • The current object is not available for conditions on a list context menu (the List context menu check box is selected). Any use of current on these actions is ignored.

What i want is to control visibility in function of some information of the row.

Example:

task1 , number = 1

task2 , number = 2

task3 , number = 3

what i can write in the condition field to show that list control context for the task that its number is 2 , or what is the alternative of that ?

usualy for a simple form button we do this : current.number = 2.

What i can do here pls ?
Thank you

14 REPLIES 14

Abhinay Erra
Giga Sage

LOL. I have tested this and it should work. There are many out of box UI actions of type list context menu which use current in the conditions field


im sorry but there is some thing weird cause in the wiki too they say that :



Note:


  • The current object is not available for conditions on a list context menu (the List context menu check box is selected). Any use of current on these actions is ignored.

check that here:


http://wiki.servicenow.com/index.php?title=UI_Actions#gsc.tab=0



just before 4.2


This is the screenshot of out of box UI action.


find_real_file.png


yes there are many ui actions that use current but it doas not work try to test 'approve' for approvals



the condition is : isApprovalMine(current) && current.sysapproval.sys_class_name != 'change_request'



but i can see it for all rows however im not approver or even the sysapproval.sys_class_name == 'change_request'



simply the condition is ignored !!!


Is the issue resolved?


I have the same requirement where I want to hide 'Approve' button(list context menu) only for change table.


All conventional methods are not working for list context menu.