- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2017 10:25 AM
Hi Everyone,
I'm trying to automatically close a service catalog task based on and end user clicking on a link in an automatically-sent email. Here's the inbound action script that I'm trying to use:
closeUserAcceptanceTask();
function closeUserAcceptanceTask(){
// Go through all of the RITMs in this REQ and see if they are approved
var gr_task = new GlideRecord('sc_task');
gr_task.addActiveQuery();
gr_task.addQuery('sc_req_item', current.request_item.request);
gr_task.addQuery('short_description', 'STARTSWITH', 'User Acceptance');
gr_task.query();
while(gr_task.next()) {
gr_task.state = "closed_complete";
}
}
I have also checked out the following URL, but I couldn't get it working either:
https://community.servicenow.com/thread/176755?q=Close%20Service%20Catalog%20Task%20via%20Email
Thanks in advance for your help.
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2017 04:32 PM
Thanks so much - this was resolved by a co-worker. If anyone's interested in the solution, I can then type it out at another date - it's too long to do unless someone asks. Many thanks for everyone's time and effort - you got me closer to the solution that you may know!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2017 10:38 AM
Hi Chris,
i think you did not mention the gr_task.update() in last line
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2017 10:44 AM
Hi Chirs,
gr_task.addQuery('sc_req_item', current.request_item.request); will always give a null result because you are looking for item but you are providing sys id of the request.
Alos, you are using current in that , for inbound action using current is of no use.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2017 10:46 AM
Also, even once you correct that your quesry is going to update all the task which would be active and start with user acceptance, I am sure you don't want that
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2017 10:58 AM
Thank you both for the help. Yes, I am trying to just update the one task that the user is replying to. What query would I need to do that? I certainly do not want to close all tasks that are open.