Expand my Community achievements bar.

Announcing the launch of new sub-community for Campaign Web UI to cater specifically to the needs of Campaign Web UI users!
SOLVED

Send variables to a subworkflow

Avatar

Level 5

Is there a way to send variables to a subworkflow? 

 

Like for example, I generate a variable a = 1 in a workflow, then call a subworkflow that takes A value and adds 5 to it. Is it possible? How can I do it?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @CampaignerForLife 

 

In your main wf define the variable like this:

vars.mainWFVar=1;

Master WF:

Manoj_Kumar__0-1679483835548.png

 

Then in the Sub-workflow you can use the same variables to add values to it:

vars.varfromMainWF = vars.mainWFVar + 5;
logInfo(vars.varfromMainWF)

Sub-workflow

Manoj_Kumar__1-1679483939891.png

 

And if you start the mast WF you see the updated added in the logs:

Manoj_Kumar__2-1679484007671.png

 

 

 


     Manoj
     Find me on LinkedIn

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hello @CampaignerForLife 

 

In your main wf define the variable like this:

vars.mainWFVar=1;

Master WF:

Manoj_Kumar__0-1679483835548.png

 

Then in the Sub-workflow you can use the same variables to add values to it:

vars.varfromMainWF = vars.mainWFVar + 5;
logInfo(vars.varfromMainWF)

Sub-workflow

Manoj_Kumar__1-1679483939891.png

 

And if you start the mast WF you see the updated added in the logs:

Manoj_Kumar__2-1679484007671.png

 

 

 


     Manoj
     Find me on LinkedIn