Related list ui action button
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2018 03:10 AM
Hi All,
I would like to make the Button(Custom Button named"Relate" ) present in the Related list to be visible, if the Related list has no empty Records.
If there are no records in related list(EMTY) I would like to hide that Button.
(Or)
Then button should be visible only when you select any of the records in the Related list.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2018 03:17 AM
Hi Aj,
you will have to write script include and call that in the condition field of UI action and then show/hide the button.
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2018 03:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2018 04:10 AM
Hi Aj,
Steps below. you must be having a field on Catalog Item table which refers to the current form.
In my example below: I have added the button name "Sample Button" on Catalog Variable Set table(io_set_item) which has a field which refers to Catalog item. The button would be shown/hidden in related list.
The button will be shown only when there is at least 1 variable set tagged to that catalog item.
Script Include:
Name: TestFilter
API Name: global.TestFilter
Script:
var TestFilter = Class.create();
TestFilter.prototype = {
initialize: function() {
},
checkRecord: function(sysId){
gs.log("ANK 12 sysId is:"+sysId);
var gr = new GlideRecord('io_set_item');
gr.addQuery('sc_cat_item', sysId);
gr.query();
gs.log("ANK 12 row count is:"+gr.getRowCount());
if(gr.hasNext())
return true;
return false;
},
type: 'TestFilter'
};
UI Action:
Condition: new global.TestFilter().checkRecord(current.sc_cat_item.sys_id);
here I am passing the Catalog Item Sys Id so that I can query the Catalog Variable Set table to check if any variable set exists for this catalog item:
Testing:
1) Catalog Item having variable set: Button Shown
2) Catalog Item having no variable set: Button hidden
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2018 06:28 AM
I followed the steps suggested by you but still facing issue.