How to trigger flow in record producer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2023 06:47 AM
Hi All, Can anyone suggest how to trigger flow for a particular record producer? and can we create multiple tasks and approvals for record producers too like service catalogs?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2023 06:50 AM
Hi @mickydash2001 ,
You can refer to the solution :https://www.servicenow.com/community/now-platform-forum/how-to-trigger-flow-after-record-producer-is...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2023 07:49 AM
Hi @mickydash2001 ,
I trust you are doing great.
To trigger a flow for a particular record producer, you can use the "before record producer" business rule. This business rule is executed when a user submits a record producer, before the record producer is created. You can use this business rule to start a flow that performs additional processing before the record producer is created.
Here's some sample code that demonstrates how to trigger a flow for a specific record producer using the "before record producer" business rule:
(function executeRule(current, previous /*null when async*/) {
// Check if the record producer being submitted is the one we're interested in
if (current.producer.name == "My Record Producer") {
// Create a GlideRecord object for the Flow Definition table
var flowDef = new GlideRecord("sys_flow_definition");
// Set the query to find the flow definition we want to trigger
flowDef.addQuery("name", "My Flow Definition");
// Execute the query
flowDef.query();
// If a matching flow definition was found, trigger it
if (flowDef.next()) {
var flowAPI = new FlowAPI();
flowAPI.startFlow(flowDef.getValue("sys_id"), current, null);
}
}
})(current, previous);
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2023 08:28 AM
Hi @Amit Gujarathi ,
Thanks for the response.
Just one doubt. The tasks and approvals of flow are based on values selected in record producer. And here this business rule is triggering the flow before record producer. So will it work?