Hide a UI action in CSM case table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2023 12:56 AM
There is a UI action called "InReview" available on Case Form, We need to hide this UI action when case task moved to some state(state initiate action). Case task is available in related list table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2023 02:11 PM
Hi @ABHISHEK PORWA1 ,
If you need to hide an UI action on case table when one of the Case Tasks moves to a state, you can create a script include to verify the state of the related case tasks and add this as the condition of your UI action.
You'll want to do something like this, for the condition of your UI action simply call your script include, for example: javascript:new global.CaseUtils().verifyTaskState();
And for your script include, you could work with something like this:
var CaseUtils = Class.create();
CaseUtils.prototype = {
initialize: function() {},
verifyTaskState: function() {
var taskState = new GlideRecord('sn_customerservice_task');
taskState.addQuery('parent_case', current.sys_id);
taskState.query();
while (taskState.next()) { /// check all the case tasks to verify if one has the state that you need to hide the UI action
if (taskState.state == '3') { // the state that you'd like to hide your UI action
return false; // will hide the UI Action
}
}
return true; // will show the UI action
},
type: 'CaseUtils'
};
If that helps please mark my answer as correct / helpful!
And if further help is needed please let me know
Cheers