Remove "Add" UI Action from the custom related list
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2024 06:23 AM
Hello All,
We created a custom related list for the incident table, and the OOB "Add" UI Action appeared here. We need to hide this from this related list only, however there is no option to omit it, and we tried adding code to the UI Action condition but it did not work. Does anyone have any ideas?
Code we tried - !current.related_list.is("sys_id_of_related_list")&&
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2024 09:14 AM
omit edit button get disables here as we can see in the screenshot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2024 10:45 AM
The Omit edit button is grayed out as this is not valid/possible on custom related lists. You are already omitting the New button, which is why that one is not shown. On the Add UI Action you have pictured, all you need in the condition is to not show it on related lists, so
!RP.isRelatedList()
Add this to the beginning or end of whatever else might be there, joining to the other conditions with &&, or if this is already there without the !, just add the !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2024 11:00 AM
Hello Brad,
Thanks for reply, If i implement your solution it will hide in all related lists. However we want to hide it for one single custom related list.
I tried this code
!current.related_list.is("sys_id_of_related_list")
But didn't worked
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2024 11:58 AM
'current' in this case will refer to the queries_from table, which is change_request, while the related_list field is on the sys_ui_list_control table. I came up with this, which seems to work
RP.isRelatedList()&&RP.getListControl().getControlID()!='996e692d53099650324c17c0a0490ebb'
Where that last bit is the sys_id of the List Control record for this Related List - so right-click, Configure, List Control, then right-click in the gray header and Copy sys_id.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2024 11:09 PM
This worked, Thank you Brad