
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2020 07:56 AM
Hi guys,
I’m currently working on enhancing a Flow I created a while ago. What I need to do is to be able to trigger it and set some parameters while I’m on it. I know SN provides the following methods:
-
executeFlow(flow name, inputs)
-
startFlow(flow name, inputs)
They seem to allow passing inputs as parameter, however I don’t see a way to configure or retrieve them in the Flow.
The context is: This flow will run all the ATF test suites, gather the results and send that info to the stakeholders. I created it and it works, however now we need to run two sets of suits: One for Chrome and one for Firefox to make sure all the client side stuff works correctly in those browsers. I wanted to re-use the flow by triggering it from a scheduled job and passing a parameter with the browser.
PS: While writing this question I realized that I might be able to save this flow as a subflow and trigger it from the script while passing the inputs as parameters. I’ll check if there are no repercutions to this.
Solved! Go to Solution.
- Labels:
-
flow designer

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2020 08:08 AM
Hi there,
executeFlow and startFlow are actually old deperecated methods. You could use:
Async:
var inputs = {
'sysid' : '9d385017c611228701d22104cc95c371'
};
var result = sn_fd.FlowAPI
.getRunner()
.subflow(inputs)
.inBackground()
.withInputs(inputs)
.run();
Sync:
var inputs = {
'sysid' : '9d385017c611228701d22104cc95c371'
};
var result = sn_fd.FlowAPI
.getRunner()
.subflow(inputs)
.inForeground()
.withInputs(inputs)
.run();
In this example I'm only providing a sys_id as input and expecting the subflow to contain a input "sysid".
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2020 08:08 AM
Hi there,
executeFlow and startFlow are actually old deperecated methods. You could use:
Async:
var inputs = {
'sysid' : '9d385017c611228701d22104cc95c371'
};
var result = sn_fd.FlowAPI
.getRunner()
.subflow(inputs)
.inBackground()
.withInputs(inputs)
.run();
Sync:
var inputs = {
'sysid' : '9d385017c611228701d22104cc95c371'
};
var result = sn_fd.FlowAPI
.getRunner()
.subflow(inputs)
.inForeground()
.withInputs(inputs)
.run();
In this example I'm only providing a sys_id as input and expecting the subflow to contain a input "sysid".
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2020 08:29 AM
Hi mark, thanks for the help.
I'm surprised the Dev portal still shows the methods I mentioned in the original post even though they are deprecated.
Mark, from what I see those methods trigger a subflow. Is there something similar for a Flow while still passing inputs as parameters? If there aren't, I think I'll just re-create the flow as a subflow and trigger it the way you mentioned.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2020 09:45 AM
Ah indeed, several pages on docs/developer site still mention the old method. Also see below picture:
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2020 09:46 AM
I haven't tried, though you could try .flow instead of .subflow.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field