Can we create flow using script

VaibhavP5059517
Giga Guru

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

1 ACCEPTED SOLUTION

Diogo Ramos
Tera Sage

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 !

View solution in original post

23 REPLIES 23

Hey @PoonkodiS ,
Thank for the response, but I think you didn't get the question, I am asking about creating flow not triggering a flow or creating flow action using script.

Hi @VaibhavP5059517 

I don't know is there is any way to create flow through script.According to my view, the answer is no.

 

- Poonkodi 

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]

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