How to use "Return Value" workflow activity functionality in "Run script"

Andre27
Tera Contributor

hi all,

what I know is how to pass a parameter from "sub-workflow" to "parent-workflow" by using "Return Value" (in subflow) and "Map return value to" (in parentflow). That works fine.

But I like to implement the functionality of "Return Value" workflow activity in my own "Run script".

My goal is to implement a generic activity in subflow:

- Input Values: param_name, param_value

- Functionality:

1. check if an key/value object in workflow.scatchpad._returnArray exists

2. if yes, use it, otherwise create a new one

3. put the param_name, param_value to key/value object

4. put key/value object back to workflow.scatchpad._returnArray

5. put key/value object to context for return value like "Return Value" workflow activity does. but in my script and not by using core "Return Value" workflow activity. How does requirement 5. work?

Thanks so much

Regards Andre

 

 

2 REPLIES 2

KristyS
Kilo Guru

I have the same problem when I create a child workflow via script.   Were you able to find a solution to this?

 

If i use the OOB sub workflow activity then my child workflow does not present the catalog variables on the task form therefore i have scripted the workflow kickoff.  I am unable to get a return value from my child workflow causing the REQ to close prematurely or hang on the parent wait condition.   

 

I have tried to push variable inputs to create a return value and a hidden variable on the child wf but have been unsuccessful with either solution.

Hi Kristy,

 

In the run script activity you return values using following-

 activity.result = myFunction() 

In the myFunction you can have whatever code is required, do not forget to return a value in the function.

 

After the code is written, you can add as many conditions to the run script activity for transitions.

 

In the Conditions you can have condition in the format-

activity.result=={whatever value your function returns}

 

Please mark this helpful if it is 🙂