When cancelling a request, what causes Tasks to close?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2015 07:43 AM
Hi Everyone,
When using the OOB Cancel UI Action on the sc_request, it cancels the Request, closes sc_req_items, closes, tasks, and cancels workflows. My question is, what code is specifically closing the sc_tasks?
I've been poking around for a bit, but I'm struggling to narrow it down.
Thanks,Scott
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2016 11:12 PM
Hello Eduard G,
There is a business rule called "Close Tasks Due to Cancellations" which change the state of Tasks when request is cancelled.
We have one requirement when request is cancelled then its associated RITM and Task's state should also be set to Cancelled. But the thing is I am not able to find any code in Geneva instance which is changing the state of RITM.
Through cancel button I can change the state of Request. And for task's state change above B rule can be updated as required. But for request it automatically moves to "Closed Incomplete" but don't know how. I got some B rule which must be the cause but still did not find function.
request item closure --> have below code
// we just closed this requested item. Have to cancel its approvals
var reqItem = new SNC.RequestItem(current);
if (reqItem)
reqItem.cancelRelatedRecords(); --> I am not sure where this function comes from
Please reply if you find any solution.
Sneha Gadawe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2016 01:09 AM
Hi,
This function comes from the platform and it is not available for customisation.
Thanks,
Deepak.
PS: Hit like, Helpful or Correct depending on the impact of the response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2016 01:26 AM
But if you really want to change the state to something else, then, you can change the state later by script:
// we just closed this requested item. Have to cancel its approvals
var request = new SNC.Request(current);
if (request)
request.cancelRelatedRecords();
var req = new GlideRecord('sc_req_item');
req.addQuery('request', current.sys_id);
req.query();
while(req.next()) {
req.state = 3;
req.update();
}
Change the code accordingly. This is just dummy code. Please verify before using.
Thanks,
Deepak.
PS: Hit like, Helpful or Correct depending on the impact of the response.