- 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-20-2022 06:37 AM
Hi Ankur,
I tried the modified script by including "toString()" but still the result is same. It is working fine for the required Catalog however it affected all the other catalog tasks and what I noticed is for all the other Catalog tasks it removed the Close Task button for all the assignment groups.
My script include screen shot
My UI action condition
current.state.canWrite() && current.state != -5 && current.state < 3 && current.approval != 'requested'&& (current.variables.ready_for_deployment_task!='true' || current.variables.review_task=='true') && new ShowCloseTask().checkCondition(current);
regards,
Raghesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2022 07:04 AM
Hi,
script include looks fine to me
ensure you debug the other conditions one by one
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-20-2022 07:12 AM
Hi Ankur,
Sure let me try. Really appreciate your support!!
regards,
Raghesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2022 07:19 AM
I believe I have answered your question.
If my response helped you please mark it correct to close the question so that it benefits future readers as well.
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-20-2022 07:27 AM
Hi Ankur,
Yes your answer helped and I will close this thread.
There was one more point which I mentioned in my first thread, but no issues I will open a separate thread for the same.
Point was
"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."
regards,
Raghesh