- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-24-2022 01:24 AM
hi
ihave a requirement that, we need to hide the close task button and close complete option in state field on change task when rfc record is created on change request and change task short description contains System Test & Validation.
below are the code i wrote but here close task button some times is not hiding please give me your suggestion or can we take sysyid of the close task
Solved! Go to Solution.
- Labels:
-
Cost Management (ITSM)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-24-2022 05:35 AM
Hi
Please find the steps you need to follow to achieve your requirement:
1) Create a Script Include and use the script as below:
var uiActionVisibility = Class.create();
uiActionVisibility.prototype = {
initialize: function() {
},
buttonDisplay : function(changeID){
var gr = new GlideRecord('u_charm_rfcs');
gr.addQuery('FieldName',changeID); // Replace 'FieldName' witht he field which is present on your Charm Rfcs table which will be a Reference field and connecting to Change record
gr.query();
if(gr.next()){
return false;
}else{
return true;
}
},
type: 'uiActionVisibility'
};
Now Close task button present on Change Task you need to add the below line to your existing Script with an AND condition and pass the Change Request ID as shown below:
current.state < 3 && current.approval != 'requested' && !current.change_request.on_hold && new uiActionVisibility().buttonDisplay(current.change_request)
Let me know how you go with this:
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-24-2022 01:41 AM
Can you please help on these

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-24-2022 01:54 AM
Ankur has provided the correct response, calling the script include in the UI action for hiding. This will surely help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-24-2022 05:35 AM
Hi
Please find the steps you need to follow to achieve your requirement:
1) Create a Script Include and use the script as below:
var uiActionVisibility = Class.create();
uiActionVisibility.prototype = {
initialize: function() {
},
buttonDisplay : function(changeID){
var gr = new GlideRecord('u_charm_rfcs');
gr.addQuery('FieldName',changeID); // Replace 'FieldName' witht he field which is present on your Charm Rfcs table which will be a Reference field and connecting to Change record
gr.query();
if(gr.next()){
return false;
}else{
return true;
}
},
type: 'uiActionVisibility'
};
Now Close task button present on Change Task you need to add the below line to your existing Script with an AND condition and pass the Change Request ID as shown below:
current.state < 3 && current.approval != 'requested' && !current.change_request.on_hold && new uiActionVisibility().buttonDisplay(current.change_request)
Let me know how you go with this:
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-24-2022 06:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-24-2022 06:24 AM
That was just an example I showed by making an edit to the UI Action Close Task present on Change Task table.
You just need to add the below two condition tp the condition field of UI Action. If there are any existing condition then use an && operator and add the conditions mentioned below:
new uiActionVisibility().buttonDisplay(current.change_request) && current.short_description != 'Provide the text here which you want'
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke