Can we execute flow designer using business rule script

manoj1
Tera Contributor

I want to execute flow designer using Business rule on Import set table. Is it possible to execute, if yes can someone help me on business rule script.

6 REPLIES 6

Karan Chhabra6
Mega Sage
Mega Sage

Hi @manoj1 ,

 

You can use the flow API in your business rule, here's an example from the official docs

// Map inputs. For a flow with a record trigger, inputs are the record and table
  var inputs = {};
  inputs['current'] = current; // GlideRecord of table:  
  inputs['table_name'] = 'incident';

   // Execute the global flow called test_flow 
   sn_fd.FlowAPI.executeFlow('global.test_flow', inputs);

refer to this doc: https://developer.servicenow.com/dev.do#!/learn/learning-plans/tokyo/servicenow_application_develope...

 

You don't even need to write the code yourself, every flow generates the code snippet which you can leverage in your scripts.

 

Open the flow which you want to call and click on more action button (...), select create code snippet

KaranChhabra6_0-1684336373650.png

 

It will generate a code which you can copy and use in your script, example:

KaranChhabra6_1-1684336439737.png

 

If my answer has helped with your question, please mark it as correct and helpful

 

Thanks,

Karan

 

 

 

 

Hi karan,

 

what should I provide in 

inputs['current'] = ;

can you pleases help me 

Mallidi Suma
Tera Guru

Hi @manoj1 ,

 

Yes, we can flow from a Business Rule script. Please find the below Docs Link

 

Simply you can open the respective Flow Designer and go to the create code snipper make sure you activated your flow copy the code snippet and paste it into the BR.

 

MallidiSuma_0-1684336556794.png

 

For more information you can visit this URL

 

https://developer.servicenow.com/dev.do#!/reference/api/rome/server/sn_fd-namespace/ScriptableFlowRu...

 

 

Please mark my answer as helpful and accept it as a solution, if it helps you.

 

Thanks & Regards,

Suma.

 

 

 

 

 

Amit Gujarathi
Giga Sage
Giga Sage

HI @manoj1 ,
I trust you are doing fine.
Yes, it is possible to execute Flow Designer using a Business Rule on the Import Set table. In order to help you with the business rule script, please provide more details about the specific actions or conditions you want to trigger the Flow Designer execution. This will allow me to assist you more effectively in creating the script.


Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi