- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2020 08:36 AM
I have a requirement in which I need to create an sc_task from an inbound REST call attached to an existing RITM. I then need to watch that task and close the RITM when the task is closed. The problem is that I'm running into a wall when it comes to triggering the Flow. Since it's on a Service Catalog table I can only use the Service Catalog trigger (which is apparently an Orlando change) and I can't seem to find the right set of inputs to fire the Flow from the Scripted REST action.
Has anyone found the right set of inputs or a way to trigger the Flow from script on a Service Catalog item?
Thanks
Solved! Go to Solution.
- Labels:
-
flow designer

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2020 01:01 PM
Hi Tom,
If the REST call is creating a task and you effectively need to attach a flow onto the record in order to close it once a criteria is met, you can create a subflow and use the cope snipped it provides to then complete what you need.
First question - can't you simply setup a business rule that auto-closes the RITM when no open tasks remains (believe this is even OOB behaviour) or are you wanting to force close the RITM even if other tasks are currently open/active?
Regarding your needs:
Create a subflow with a reference input to the catalog task [sc_task] table.
Add a wait condition for the catalog task provided as an input
Once the wait condition is met, use an update record action to close the RITM.
Flow can then provide the code snippet to call the flow (note the below is the new Flow API for paris, your instance will provide the API function for Orlando and below).
(function() {
try {
var inputs = {};
inputs['catalog_task'] = ; // GlideRecord of table: sc_task - pop the record just created here.
var result = sn_fd.FlowAPI.getRunner().subflow('global.close_ritm').inBackground().withInputs(inputs).run();
var outputs = result.getOutputs();
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2020 01:01 PM
Hi Tom,
If the REST call is creating a task and you effectively need to attach a flow onto the record in order to close it once a criteria is met, you can create a subflow and use the cope snipped it provides to then complete what you need.
First question - can't you simply setup a business rule that auto-closes the RITM when no open tasks remains (believe this is even OOB behaviour) or are you wanting to force close the RITM even if other tasks are currently open/active?
Regarding your needs:
Create a subflow with a reference input to the catalog task [sc_task] table.
Add a wait condition for the catalog task provided as an input
Once the wait condition is met, use an update record action to close the RITM.
Flow can then provide the code snippet to call the flow (note the below is the new Flow API for paris, your instance will provide the API function for Orlando and below).
(function() {
try {
var inputs = {};
inputs['catalog_task'] = ; // GlideRecord of table: sc_task - pop the record just created here.
var result = sn_fd.FlowAPI.getRunner().subflow('global.close_ritm').inBackground().withInputs(inputs).run();
var outputs = result.getOutputs();
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2020 12:33 PM
Hi Kieran,
Thanks for the very detailed reply! I ended up figuring out how to attach a subflow before the question made it through moderation.This answer is definitely helpful for additional work I have on other projects though, so thank you!
To answer the question regarding creating a business rule: There are points where the ticket is still being worked where all tasks may be closed, but the RITM still has work left or a delay before more tasks are created.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2020 12:41 PM
Glad to hear you solved the issue 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2020 02:52 AM
Hi Tom, can you mark an answer correct to close this question.