- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2022 01:46 AM
I created a run button on the incident form as shown in the image below.
This was set for the purpose of executing the flow created by Flow Designer.
Is there a way to specify the flow in script and execute it?
I'm thinking of setting the flow to be executed only when the button is pressed.
I'm also thinking of creating a new field, changing the status when the button is pressed, and executing the flow triggered by the status change.
However, I'm wondering if there is any other way than adding more fields or changing the status.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2022 01:54 AM
Hi,
yes you can make flow trigger from that button
keep that UI action as server side and use this script
var flowInputs = {};
flowInputs['current'] = current;
flowInputs['table_name'] = current.getTableName();
var result = sn_fd.Flow.startAsync('flow name', flowInputs);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2022 01:54 AM
Hi,
yes you can make flow trigger from that button
keep that UI action as server side and use this script
var flowInputs = {};
flowInputs['current'] = current;
flowInputs['table_name'] = current.getTableName();
var result = sn_fd.Flow.startAsync('flow name', flowInputs);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2022 01:55 AM
Hi
yes, you can trigger (Sub-Flows) via script. See https://developer.servicenow.com/dev.do#!/learn/courses/rome/app_store_learnv2_flowdesigner_rome_flo...
In your case I recommend using a Sub-Flow as that way you can pass the underlying Incident directly to the Sub-Flow as input parameter.
Kind regards
Maik

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2022 04:28 AM
Hi,
As others have already replied, it is possible to execute a sub-flow. However, if the user pressed the button several times, the sub-flow may be executed several times. Is this OK? Would user be able to press the button after the incident is resolved? Adding all these requirements would make it more complicated.
What is the use case? What is pressing the button suppose to do? There may be a better easier way to satisfy the requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2022 09:18 PM
thank you for your answer.
I want to change the status once the button is pressed and hide the UI action button when the status changes.