
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 08:07 AM
hello Team,
as per my requirement, for each catalog item, several tasks should be created. so I'm using paralell flow.
if i closed first task - then 2 tasks should be created. once 2 tasks closed then remain 2 tasks should be created.
it's working as i expected but when close 1st task - related RITM automatically closed but still remain SCTask open.
please find my flow. it's happend only for this flow. please suggest how we can reproduce the issue.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2022 04:49 AM
Sorry for delay response due to unavailiability.
Please try below code once:
var tasks = new GlideRecord('sc_task');
tasks.addQuery('request_item',current.request_item);
tasks.addQuery('state', '!=' , '3');
tasks.query();
if(tasks.hasNext())
{
current.setAbortAction(true);
} else {
var rq = new GlideRecord('sc_req_item');
rq.addQuery('sys_id',current.request_item);
rq.query();
if(rq.next())
{
rq.state = 3;
rq.update();
}
}
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2022 07:12 AM
thank you Saurav,
i have added if condition before task gliderecord it's working now. but if add in " CONDITION" it's not working .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2022 07:14 AM
Hello,
If my answer helped you can you also mark it as correct.
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 08:11 AM
another requirement is :
i want to copy the attachment what ever attached from one task to another task.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2022 02:00 AM
Auto closing of RITM is happening even if this Flow is inactive or not present?
Please check if there is any other Workflow attached in the RITM and SCTASK record which may be auto closing the RITM.
Or check if there is any BR running on SCTASK table which is auto closing RITM.
Also to copy attachments from 1 record to another record, you can use below function:
attachment.copy('sc_task', firstScTaskSysID, 'sc_task', secondScTaskSysID);
https://developer.servicenow.com/dev.do#!/reference/api/quebec/server/r_SGSA-copy_S_S_S_S
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2022 03:25 AM
hi Anubhav,
yes, I written the BR to donot complete the RITM when SCTask is still open,
it's working for rest of the catalog item, if i make it as inactive then it's working :):)
see my below code,
(function executeRule(current, previous /*null when async*/ ) {
var count=0;
var tasks = new GlideRecord('sc_task');
tasks.addQuery('request_item',current.request_item);
tasks.query();
var taskcount = tasks.getRowCount();
while(tasks.next())
{
if(tasks.state == 3)
{
count++;
}
}
if(count == taskcount)
{
var rq = new GlideRecord('sc_req_item');
rq.addQuery('sys_id',current.request_item);
rq.query();
if(rq.next())
{
rq.state = 3;
rq.update();
}
}
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2022 04:17 AM
can anyone help ?