Grey out "No longer Required" option from the Approval drop down "Action on selected rows"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 01:46 AM
Hi,
I have a requirement to grey out/hide "No longer Required" option from the Approval drop down from "Action on selected rows" and this should be hidden only to tickets generated from a particular catalog item. How can I achieve this? Any suggestions would be greatly appreciated. Here is the screenshot of the requirement. I have to hide "No longer Required" option which is highlighted in yellow for tickets generated from a particular catalog item. Please guide me.
Thanks,
Saran.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2023 03:21 AM - edited 12-05-2023 03:24 AM
Hi @Community Alums
Oops! It's because the table, what I gave you before is for Requested item [sc_req_item] table.
And from your screenshot, I can see it's for Request [sc_request] table. So there'll be no Cat Item [cat_item] field in this table.
We need to define a function in a script include to achieve it.
#Script Include
var CLCatalogItemUtils = Class.create();
CLCatalogItemUtils.prototype = {
initialize: function() {
},
isVisible: function(current){
//apply only Request table
if(current.source_table != 'sc_request'){
return true;
}
var itemID = 'e591f18b47eaf990ab9bb6bf016d430b'; //Snack Ordering
var grRITM = new GlideRecord('sc_req_item');
grRITM.addQuery('request', current.sysapproval);
grRITM.addQuery('cat_item', '!=', itemID);
grRITM.query();
return grRITM.hasNext();
},
type: 'CLCatalogItemUtils'
};
#UI Action
new CLCatalogItemUtils().isVisible(current);
My Test Case with the Approve button
#Snack Ordering
#Other item
Cheers,
Tai Vu
