How to trigger workflow from business rule & it should only run when its triggered from business rule

ak6
Tera Contributor

Hi all,

I have created one custom application (similar to service request) in this, I have created one workflow but it should run only when its triggered from business rule, it should not run when the ticket is created or updated in the custom application.

Please help me with this.

Thanks in advance!!

 

 

5 REPLIES 5

Harish KM
Kilo Patron
Kilo Patron

Hi you can try the below script from BR

var wflw = new Workflow();

wflw.startFlow(wflw.getWorkflowFromName('give the workflow name'), current, 'update'); // replace the wf name

Also you can refer OOB Business rule called "Start Workflow". go to BR search by name "Start Workflow"

Regards
Harish

Hi Harish please tell us  which BR is use here?

suvro
Mega Sage
Mega Sage

1. In the workflow property and conditions, make sure no conditions are defined to trigger workflow automatically.

2. Use the script below to trigger it from business rule

 

var wflw = new Workflow();

wflw.startFlow(wflw.getWorkflowFromName('give the workflow name'), current, 'update');

 

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Why to trigger the workflow only from BR?

Anyhow BR would run on insert/update of the custom table

Can you explain your business requirement here?

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader