Create a New Module to Run a Flow?

mfhaciahmetoglu
Mega Sage

Hey all,

 

I have a small question.

 

I want to create a new module under All. And when the user choose this module, I want a flow in the flow designer to be activated.

 

mfhaciahmetoglu_0-1713533307159.png

 

Do you know how this can be done?

 

Thanks.

 

Best,

Firat

1 ACCEPTED SOLUTION

Ryan Duce
Tera Guru

Choose Script (from Arguments) and paste the following script into the arguments field (docs)

// Starts the flow asynchronously.
          var result = sn_fd.FlowAPI.getRunner()
          .flow('global.myFlow')
          .inBackground()
          .withInputs(inputs)
          .run();​

Worth bearing in mind that the Flow runs asynchronously with the above code. No feedback will be presented to the user on the success or failure of the Flow.

 

As others have said, it's probably better to use the same script in a UI Action or a more context-sensitive area.

View solution in original post

9 REPLIES 9

Yes mate, you catch it well now. 

 

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

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/atul_grover_lng [ Connect for 1-1 Session]

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

This did not work as it creating a record in this was is not the same as you create from service catalog. 

 

But I might have found a solution.

 

  1. I can choose Link Type: Script 
  2. Write a script include which trigger the flow.

This might be the real solution I am looking for.

 

Best,

Firat

Hi @mfhaciahmetoglu 

 

This did not work as it creating a record in this was is not the same as you create from service catalog.  - Yes this is the right way.

 

But I might have found a solution.

 

  1. I can choose Link Type: Script 
  2. Write a script include which trigger the flow.

This might be the real solution I am looking for.

 

Atul: What is your use case? If you write the script on Link type, then also need a record to be created. Give a try buddy and share feedback.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

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/atul_grover_lng [ Connect for 1-1 Session]

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

mfhaciahmetoglu
Mega Sage

My solution:

 

- I could not find a way to call a flow from a Module.

- Instead, I used a UI Action button and called a subflow.

Ryan Duce
Tera Guru

Choose Script (from Arguments) and paste the following script into the arguments field (docs)

// Starts the flow asynchronously.
          var result = sn_fd.FlowAPI.getRunner()
          .flow('global.myFlow')
          .inBackground()
          .withInputs(inputs)
          .run();​

Worth bearing in mind that the Flow runs asynchronously with the above code. No feedback will be presented to the user on the success or failure of the Flow.

 

As others have said, it's probably better to use the same script in a UI Action or a more context-sensitive area.