Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

flow designer trigger and user

begsa
Tera Expert

I have a few questions here:
1) Can I create a flow without a trigger defined? I want to be able to call it on demand from a script.

2) How can I call a flow from a script include?

3) On the beginning of the flow, I want to know who the logged in user is, how do I get the logged in user?

 

1 ACCEPTED SOLUTION

Maik Skoddow
Tera Patron

Hi @begsa 

  1. No, Flows need a trigger. But you can use Subflows instead. They can be invoked from a script without a trigger.
  2. It is extensively explained at https://developer.servicenow.com/dev.do#!/learn/learning-plans/vancouver/servicenow_application_deve... 
  3. You can use a Flow variable and assign the respective value to that Flow variable via inline script: 
    MaikSkoddow_0-1704527588884.png

Maik

View solution in original post

3 REPLIES 3

Maik Skoddow
Tera Patron

Hi @begsa 

  1. No, Flows need a trigger. But you can use Subflows instead. They can be invoked from a script without a trigger.
  2. It is extensively explained at https://developer.servicenow.com/dev.do#!/learn/learning-plans/vancouver/servicenow_application_deve... 
  3. You can use a Flow variable and assign the respective value to that Flow variable via inline script: 
    MaikSkoddow_0-1704527588884.png

Maik

Dr Atul G- LNG
Tera Patron

Hi @begsa 

 

For the 1st  pint, A flow minimum requires a Trigger and a Action.

*************************************************************************************************************
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]

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

begsa
Tera Expert

Thank you for the replies, having the subflow instead of the flow helped. 

 

The flow variables were not setting properly with the logged in user and the gs.getUserID() kept getting the system user the subflow was running as instead of the logged in user.  I also made the subflow client callable since I wanted to access this from a widget and set the ACL's as well.

 

I was able to call the flow from a background script and a script include as well with the code snippet.