How to show List Banner Button UI Action only in specific related lists?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 01:07 AM
Hi,
I've created a custom List Banner Button UI Action. This is on a m2m table.
This m2m table is added as a related list on many tables (through relationships). And also displayed in 5 related lists on a same table (again through relationships).
I don't want the list banner ui action to be shown in all the related lists, rather I would want that to be shown only in one of them.
I try this code, but it doesn't work. Is there any other way by which I can achieve this?
Code which I use in the condition field: gs.action.getGlideURI().get('sysparm_collection_label')=='specific tab name where I want to display the ui action'
Regards,
Bala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 02:21 AM
Hi Bala,
You can achieve this using List Controls.
Please go through the below link:
Configuring Lists - ServiceNow Wiki
Hope this will help you.
Thanks
Devi
PS: Hit like, Helpful or Correct depending on the impact of the response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 03:30 AM
Hi Devi,
Thanks for your response.
But I can only hide "New" or "Edit..." list banner buttons by configuring the lists.
As I mentioned in my question, I want to hide a "custom" UI Action which I created. I am able to hide the list banner button based on the parent table name or parent table fields by adding a condition like, "parent.sys_class_name == 'incident'" etc. But my requirement is to hide/show the button based on the related list name (or tab name). Why I need this is that the data from the same table where the list banner button is created is displayed on multiple related lists.
For example, on the incident form, there are 5 related lists, all populating data from the same table (the table where the list banner ui action is created). Let's call the related list tab names as Tab A, Tab B, Tab C, Tab D, Tab E... and the List Banner UI Action as "Relate issues". Here our requirement is to show the list banner button "Relate issues" only in Tab A, but not on the other tabs.
I'm trying the below in the condition field, but it doesn't work.
gs.action.getGlideURI().get('sysparm_collection_label') == 'Tab A'
This same code works well in the script of the UI Action. But it doesn't work in the condition field.
Hope I've explained clearly.
Regards,
Bala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 04:09 AM
Hi Bala,
Please go through this link:
Removing Form Buttons - ServiceNow Guru
Which shows how to hide UI Action buttons using client script.
Hope this will help you..
Thanks,
Devi
PS: Hit like, Helpful or Correct depending on the impact of the response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 05:33 AM
Hi Devi,
This will remove the buttons from the form. But our buttons are actually on the related lists.
To be precise, we have 5 buttons in 5 different related lists with same name. "Relate to issue". I checked the html for those 5 buttons, and they all look alike (Even the id) since those 5 buttons are generated by the same UI Action. So, I can't hide 4 of them and keep one of them (that's my requirement actually).
The only solution will be to make it work at the UI Action level by specifying a condition.
My condition was to check the name of the tab (related list) where the button is displayed. If it's the specific tab where I want to show, then the condition should pass. That's why I used the code gs.action.getGlideURI().get('sysparm_collection_label') == 'Tab A' but it doesn't work in the condition field. The same code works in the script field of the UI Action.
Any other ideas?
Regards,
Bala