Workflow Triggered Twice

Mohan Mallapu
Kilo Sage

Hi Team,

I have created one UI action 'Request Approval' , When we click on this it will trigger the associated workflow. Below is the script for same .

var wflw = new global.Workflow();
wflw.startFlow(wflw.getWorkflowFromName('workflowName'), current, current.operation()); 

 

but it was triggering the same workflow twice with few seconds diff. find the below snap of workflow properties.
Kindly check and help on this....

 

MohanMallapu_0-1674051346293.png

 

2 REPLIES 2

AnubhavRitolia
Mega Sage
Mega Sage

Hi @Mohan Mallapu 

 

There is no condition on your Workflow, it was triggered once through your UI Action script and another directly once record is created or triggered.

 

Alternative solution. 

 

When you click UI Action 'Request Approval', you must be updating any field value like Approval = Requested

 

Instead of triggering Workflow through UI Action script, why not trigger it based on condition Approval is Requested. This will not trigger it twice.

 

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023

Mohan Mallapu
Kilo Sage

Hi @AnubhavRitolia ,

 

i have tried with your solution, i have updated the workflow conditions and removed start workflow from script but still it was triggering twice, One by User and one by the system.