Can we create flow using script

VaibhavP5059517
Tera Contributor

Hey All,
I wanted to know that can we create flow using script in ServiceNow and which table stores which part of flow.

9 REPLIES 9

Dr Atul G- LNG
Tera Patron

What is the business case?

You can use a script to trigger a Flow, but why would you want to flow from script? We generally use Flow Designer to reduce the amount of custom code we need to write and maintain. If you're triggering everything through scripts, it defeats the purpose of using Flows.

Could you share the specific requirement so we can suggest the best approach?

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

Hey @Dr Atul G- LNG ,
I want to create a flow, its trigger conditions and actions using script.
I was able to create the flow but wasn't able to write the script to create the trigger and actions using scripting.

Hi @VaibhavP5059517 

What are you trying to achieve by creating a custom solution for this? It's available out of the box (OOTB), mate. By building a custom implementation, you're just adding unnecessary technical debt. Consider using the OOTB functionality unless there is a strong business requirement that it cannot meet.

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

Ankur Bawiskar
Tera Patron

@VaibhavP5059517 

I never came across any customer requirement to create a flow from script.

Flows are meant for low-code, no-code requirements and if you are creating flow using script then I think it's not recommended.

Flows are meant to be created from UI.

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Tanushree Maiti
Tera Patron

Hi @VaibhavP5059517 

 

Can you validate your requirement again- is it call flow from script OR create flow using script?

 

Flows are intended to provide a low-code way of designing and managing process logic. If an entire flow could be created through scripting alone, it would undermine the purpose of having a flow designer. Therefore, while scripts can be used for specific actions or to trigger flows, the overall flow structure is expected to be built and maintained through the visual designer.

 

You can’t build a complete flow solely through server-side scripting, since the flow structure depends on the visual logic designer.

However, you can use scripts to automate specific actions within a flow or to trigger flows programmatically.

 

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti