- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hey All,
I wanted to know that can we create flow using script in ServiceNow and which table stores which part of flow.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
Hey, going directly to your question, yes you can create a flow via code, but this has to be done via the now SDK as far as I am aware, you cannot just run a script in SN and create a flow at least in a easy way.
From SDKK 4.3.0 you normally have access to the fluent FLOW API , meaning you can also use AI to generate these flows. sdk-examples/flow-sample/src/fluent/flow-trigger-catalog-item.now.ts at main · ServiceNow/sdk-exampl...
I Hope this helps !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Yes, my requirement is creating flow using script, is it possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
hello @VaibhavP5059517 ,
As per my understanding , Answer is No .But there is one API : sn_text2flow
which will get on now assist enabled instance through which you can create flow using script but that is more complex .
If this helps you then mark it as helpful and accept as solution.
Regards,
Aditya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
Hello @VaibhavP5059517 ,
I hope you are doing well . Does your query is resolved ?
If my response helps you then mark it as helpful and accept as solution.
Regards,
Aditya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
Yes, you can create a Flow record and invoke an existing flow through script. However, adding Flow Designer actions (such as Create Record, Approval, Update Record, etc.) by directly inserting records into backend tables is not recommended because the action configuration is stored across multiple internal tables and relationships.
You can also retrieve:
Flow Sys ID from the sys_hub_flow table.
Execution Sys ID (Context ID) from the sys_flow_context table when the flow is executed using sn_fd.FlowAPI.startFlow().
If this helps, please mark the answer as Helpful.
Thanks,
Prabakaran C
LinkedIn: https://www.linkedin.com/in/prabakaran-c-534b6826a
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
The short answer is yes, absolutely! You can trigger, start, or execute a Flow, Subflow, or Action using JavaScript in ServiceNow.
ServiceNow provides a built-in API called "sn_fd.FlowAPI" specifically for this purpose. You can use it in server-side scripts like Business Rules, Script Includes, Scheduled Jobs, or UI Actions.
Here is a quick guide on how to do it.
Open your Flow in Flow Designer.
Click the More Actions button (the three dots ... in the top right corner).
Select Create Code Snippet.
Copy the auto-generated script and paste it directly into your Business Rule or Script Include.
If you find this response helpful, please mark it as Correct and Helpful.
Regards,
Priyam Sharma