Displaying UI Action only on related list

Kamal17
Kilo Sage

Hi,

I'm trying to create a client side UI action (List banner button) on a related list. The button is visible on the related list, but the issue is that the button appears in the default list view of the table also.

I tried to restrict the UI Action visibility by using the condition "g_form.getTitle() == relatedListName" in the condition field. However, the UI Action is displayed even when the condition evaluates to false. Though i have made the UI Action as client side, I see "g_form.getTitle()" is not working in the condition field.

It would be much helpful if someone can suggest me a way to restrict the UI Action to be visible only on related list.

Thanks,

Udhay

7 REPLIES 7

Tanaji Patil
Tera Guru

Hi Udhay,



By checking client check box - The UI action executes its script in the user's browser and on the server. When enabled, the Onclick field appears above the Condition field.



But conditions are always server side.



Please check this-


UI ActionsCreates the ability to choose a specific action such as clicking a button or a link.

UI Actions put these items on forms and lists:


  • buttons
  • links
  • context menu items
  • list choices
  • client - when the "Client" box is checked, the script in the script field runs on the client
  • server - when the "Client" box is unchecked, the script in the script field runs on the server
  • client - when the "Client" box is checked, the Onclick script is available, which can contain any JavaScript but normally calls a function which is specified in the script field
  • server - all conditions run on the server


Thanks,


Tanaji


I hope you can use getParentTable().


Check this link - http://wiki.servicenow.com/index.php?title=GlideList2_(g_list)#getRelated&gsc.tab=0


Sorry the getParentTable() will not work.



Please use "RP.isOneToMany() || RP.isManyToMany()" in your condition.


This will make the condition true when it is used on related list and false when used on a default list view.



Hope this solves your problem


Please mark helpful/correct answer.



Thanks,


Tanaji


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Udhay,



You use can use "List control" to restrict the UI action on related list.