- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 06:27 AM
Hi,
We have one Catalog request with three catalog tasks and UI action button "Close Task" on the catalog tasks.
Now the requirement is on the second catalog task, to show the "Close Task" UI action button only for some assignment group members and for the rest of the assignment group members this should not be visible.
Apart from this there is a STATE field in the catalog task, there also we need to hide "Close Complete" status as per the above condition.
Note: All the above should be applicable only to Catalog Task2.
Any ideas or suggestions highly appreciated.
regards,
Raghesh
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2022 05:58 AM
Hi,
use this
var ShowCloseTask = Class.create();
ShowCloseTask.prototype = Object.extendsObject(AbstractAjaxProcessor, {
initialize: function(current){
},
checkCondition: function(current){
if((gs.getUser().isMemberOf('Testing & Quality') || gs.getUser().isMemberOf('IT ServiceDesk & EUS') || gs.getUser().isMemberOf('Problem Manager')) && current.request_item.cat_item == '325ada7adbac8490d71941efaa9619bb' && current.short_description.indexOf('Task 2 : Test')){
return true;
}
else {
return false;
}
},
type: 'ShowCloseTask'
});
UI Action condition:
new ShowCloseTask().checkCondition(current);
Regards
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
‎01-19-2022 05:58 AM
Hi,
use this
var ShowCloseTask = Class.create();
ShowCloseTask.prototype = Object.extendsObject(AbstractAjaxProcessor, {
initialize: function(current){
},
checkCondition: function(current){
if((gs.getUser().isMemberOf('Testing & Quality') || gs.getUser().isMemberOf('IT ServiceDesk & EUS') || gs.getUser().isMemberOf('Problem Manager')) && current.request_item.cat_item == '325ada7adbac8490d71941efaa9619bb' && current.short_description.indexOf('Task 2 : Test')){
return true;
}
else {
return false;
}
},
type: 'ShowCloseTask'
});
UI Action condition:
new ShowCloseTask().checkCondition(current);
Regards
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
‎01-19-2022 06:35 AM
Hi Ankur,
Thank you, the script worked!! however it got applied to all the catalog items tasks.
It is not restricted to one Catalog item's second task with specific short description "Task 2 : Test".
Looks like below condition is not getting validated properly, any suggestions.
current.request_item.cat_item == '325ada7adbac8490d71941efaa9619bb' && current.short_description.indexOf('Task 2 : Test'))
regards,
Raghesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2022 06:50 AM
Hi,
Glad to know.
To make it specific for 1 task the short description for those should be unique
small update
var ShowCloseTask = Class.create();
ShowCloseTask.prototype = Object.extendsObject(AbstractAjaxProcessor, {
initialize: function(current){
},
checkCondition: function(current){
if((gs.getUser().isMemberOf('Testing & Quality') || gs.getUser().isMemberOf('IT ServiceDesk & EUS') || gs.getUser().isMemberOf('Problem Manager')) && current.request_item.cat_item == '325ada7adbac8490d71941efaa9619bb' && current.short_description.indexOf('Task 2 : Test') > -1){
return true;
}
else {
return false;
}
},
type: 'ShowCloseTask'
});
Please mark my response as correct and helpful to close the thread
Regards
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
‎01-19-2022 07:15 AM
Hi Ankur,
I have made the update to the script with > -1
Still it is disabled for all other catalog items, I am sure that the short description is unique value which is "Task 2 : Test" and it is added by the workflow.
Please find the screen shots below.
regards,
Raghesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2022 07:54 AM
all other conditions are fine
try this once
var ShowCloseTask = Class.create();
ShowCloseTask.prototype = Object.extendsObject(AbstractAjaxProcessor, {
initialize: function(current){
},
checkCondition: function(current){
if((gs.getUser().isMemberOf('Testing & Quality') || gs.getUser().isMemberOf('IT ServiceDesk & EUS') || gs.getUser().isMemberOf('Problem Manager')) && current.request_item.cat_item == '325ada7adbac8490d71941efaa9619bb' && current.short_description.toString().indexOf('Task 2 : Test') > -1){
return true;
}
else {
return false;
}
},
type: 'ShowCloseTask'
});
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader