how do i pass workflow scratchpad variables from the parent workflow to the child parallel flow?

Ravish Shetty
Tera Guru

how do I pass workflow scratchpad variables from the parent workflow to the child parallel flow?

these data are dynamic based on different interactions.

5 REPLIES 5

sachin_namjoshi
Kilo Patron
Kilo Patron

If you want to pass any values to sub flow by using the Edit Inputs then you need to change the value of glide.workflow.enable_input_variable   property     to true.

 

Then using scratch pad you can pass the values to created inputs.

 

https://community.servicenow.com/community?id=community_question&sys_id=b7cff2addb58dbc01dcaf3231f96...

 

Regards,

Sachin

Kunal Varkhede
Tera Guru

Hi,

 

Suppose you have one variable in parent workflow

workflow.scratchpad.var = 10;

And you want to pass this variable to child workflow.

Then for that you need to create input variable in child workflow from context menu. Select edit input in Child workflow context menu, and create input variable let say you create string type of variable i.e. child_val.

And Now from parent workflow click on child workflow you will see the input variable is created. And here you pass the parent variable like this $(workflow.scratchpad.var) 

In child workflow you can access it in script like gs.addInfoMessage(workflow.scratchpad.var);

 

Follow the below step:

1)Parent Workflow

(i)

find_real_file.png

 

(ii)Parent Workflow Run script hold (workflow.variables.var) value

 find_real_file.png

 

2) Child Workflow and in context menu select edit input and create one variable

(i)

find_real_file.png

(ii)Create variable by selecting edit input in child workflow

 find_real_file.png

 (iii)

After creating variable in Child workflow select child workflow from parent workflow and pass the value of parent to the input variable of child variable in created input variable

find_real_file.png 

(iv)

And In Child workflow run script activity will print your parent variable value

 find_real_file.png

And Publish both the workflow and triggered it.

You will get your value from parent to child.

 

Please Mark Correct/Helpful answer if it help you in any way.

Thanks and Regards,

Kunal. 

 

This works but to access the value in the subflow you have to use either workflow.variables.u_child_val or workflow.inputs.u_child_val. The workflow.scratchpad values are not accessible - i.e. workflow.scratchpad.var.