The CreatorCon Call for Content is officially open! Get started here.

The function to start Workflow is not working.

cspra
Giga Expert

Hi Experts,

startFlow() function does not work as expected after executing the code below from Background Script or Work Flow - Run Script.

Is there anything wrong/missing from this code? 

 

var wf = new Workflow();
var wfId = wf.getWorkflowFromName("My Workflow");
gs.log(wfId); //---> This is getting displayed!!!
wf.startFlow(wfId, null, "My Workflow", current, 'update');

Thanks!

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

Try this

 

var wf = new Workflow();
var wfId = wf.getWorkflowFromName("My Workflow");
gs.log(wfId); //---> This is getting displayed!!!
wf.startFlow(wfId,current, 'update');
-Anurag

View solution in original post

4 REPLIES 4

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

Try this

 

var wf = new Workflow();
var wfId = wf.getWorkflowFromName("My Workflow");
gs.log(wfId); //---> This is getting displayed!!!
wf.startFlow(wfId,current, 'update');
-Anurag

@Anurag  splendid!  It is now working as expected. Thanks!

cheers mate!!

-Anurag

DrewW
Mega Sage

I see that you use "current" but you did not declare current.  In a background script you have to declare everything including current.