Launch a subflow through a record producer

ronro2
Tera Contributor
Hi everyone!
 
I’m trying to figure out the best way to trigger a subflow from a Record Producer and could use some guidance.
 
Scenario:
  • I have a Record Producer based on a custom table (let’s call it table_x).
  • One of the variables is a Select Box called action.
  • One of the choices in that select box is add_restricted_access.
  • The user also selects an assignment group (reference to sys_user_group).
What I want to achieve:
When the user submits the Record Producer and the selected action is add_restricted_access, I want to automatically run a subflow that:
  1. Finds all records in table_x that match the chosen assignment_group.
  2. Updates the field u_restricted_read_access to false for all those matching records.

So basically we want to restrict reading access records on table table_xfor the assignment group chosen through the record producer. 

So my question is..
Is it possible to initiate a subflow directly from a Record Producer based on the selected variables?
And if so, what is the recommended approach or best practice for doing this?
Any advice, examples, or pointers would be greatly appreciated!
2 ACCEPTED SOLUTIONS

yashkamde
Mega Sage

Hello @ronro2 ,

 

As per my understanding, Yes you can initiate a subflow but,

don’t try to invoke the subflow directly from the Record Producer script. Instead, let the record creation event trigger a Flow, and let that Flow call the subflow. This separation of concerns is the cleanest, most scalable approach.

Refer this :

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB2657568 

If my response helped mark as helpful and accept the solution.

View solution in original post

Ankur Bawiskar
Tera Patron

@ronro2 

you can trigger flow based on Record producer submission

In process engine you can associate the published flow

OR

You can use after insert BR on that target table and then call subflow from it and pass that record sysId as input and then handle it

Flows and Subflows 

💡 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

View solution in original post

6 REPLIES 6

yashkamde
Mega Sage

Hello @ronro2 ,

 

As per my understanding, Yes you can initiate a subflow but,

don’t try to invoke the subflow directly from the Record Producer script. Instead, let the record creation event trigger a Flow, and let that Flow call the subflow. This separation of concerns is the cleanest, most scalable approach.

Refer this :

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB2657568 

If my response helped mark as helpful and accept the solution.

Ankur Bawiskar
Tera Patron

@ronro2 

you can trigger flow based on Record producer submission

In process engine you can associate the published flow

OR

You can use after insert BR on that target table and then call subflow from it and pass that record sysId as input and then handle it

Flows and Subflows 

💡 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

Ankur Bawiskar
Tera Patron

@ronro2 

you can trigger flow when record producer is submitted

🌊 YES, You CAN Launch a Flow from a Record Producer 

💡 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

@ronro2 

Hope you are doing good.

Did my reply answer your question?

💡 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