Using the Store data and Retrieve data actions


Badge +16

I have to admit that I had worked with Nintex Workflow for well over a year before I discovered these beautiful actions!  When I realised what they could do, I realised that I was repeating a lot of stuff in separate workflows unnecessarily.

Using these actions together allows you to store variable values and pass them between different instances of running workflows. Where might this ability come in handy?  Well I do not like to have workflow that are too large, so I occasionally break them down into smaller and more manageable chunks as separate workflows.  I join them together using the "Start workflow" action.  Often I will require an output from the workflows I start in the main workflow they are being started from.  Here's how to grab them:

 

Start workflow action

When configuring this to run, ensure you capture the instance ID in a text variable of the workflow you are starting.  This is required later when you retrieve whatever is returned and stored from the workflow you are starting:

Startworkflow.PNG

 

Store data

Whatever it is you want to store from the workflow you started and be passed back to the main workflow is configured here.  Choose to store the data to the current workflow instance, give it an appropriate name and then a value.

Storedata.PNG

 

Now comes the clever part, the retrieving of this value from the workflow we started in our main workflow:

Retrieve data

Make sure you are in the main workflow when you use this (so you store in the child workflow, and retrieve in the main workflow).

Configure this action to look at the instance variable we stored in Start workflow action, Item to retrieve (note this needs to be the same name as the "Store as" value in the store data action), and a variable to retrieve this data to.

Retrievedata.PNG

Now you have data from your other workflow in your main workflow!

It's not something I use very often, but it does still make me smile when I do happy.png

Enjoy!


24 replies

Badge +8

Thanks for sharing Cassy Freeman​!

Userlevel 5
Badge +12

I posted a new User Voice idea to combine the Store Data functionality with the Start Workflow action:   Combine Store Data action with Start Workflow action – Customer Feedback for Nintex 

Vote it up if you want to see it implemented.

Badge +7

Hi Cassy,

Thanks for this. If you are doing the retrieve on the parent workflow, don't you need to wait or pause before you retrieve to ensure the child workflow completed and actually stored the data?

Can you use the store/retrieve the other day, to pass information from the parent to the child? Or is there a better way? I have seen people build an association data string and then pass that to the child workflow (not using Start Workflow action but the Web Service action and configuring it to execute another workflow with the association data).

Also, am I missing something or would you need to do a store/retrieve for every single variable you want to pass?

Badge +16

In the start workflow option you have the option to wait for the workflow to complete before moving on in the workflow so a pause is not necessary.

i will check tomorrow but I am sure you can pass multiple values in the store and pull multiple values in the retrieve but I will check tomorrow. 

Again - You can pass it either way (parent to child or child to parent) - again will double check that tomorrow. 

Thanks

Badge +16

OK so here is the setting I was telling you about in "Start workflow" action that will ensure you do not need a pause - will wait for the child workflow to complete before moving on in the parent workflow:

To clarify the other question - NO  cannot use store and retrieve the other way around as there is no way the child workflow will know the "workflow instance ID" of the parent that is required in the "Retrieve data" action.

In the above screenshot the workflow I chose to start does have a variable that is on the start form and is required.  This is one way of being able to pass a value from parent to child.  Set up your child with a variable that is shown on the start form and then when you use the "Start workflow" action in your parent workflow, add your parent workflow variable data as the start data for the child workflow.

Apologies - when I was thinking about it in my head it seemed like it should have been possible the other way round but alas no.

Badge +16

Also - multiple values - looks like can only store one per "Store data" action, so you would need to use multiple "Store data" actions to store multiple values.  This seems like an oversight to me to be honest, so I have looked on uservoice and suggest voting up the feature request here:

https://nintex.uservoice.com/forums/229405-1-nintex-workflow-for-sharepoint/suggestions/18622303-allow-multiple-values-in-store-data-action

and similar idea you might like to vote up here:

https://nintex.uservoice.com/forums/229405-1-nintex-workflow-for-sharepoint/suggestions/17891656-combine-store-data-action-with-start-workflow-acti

Userlevel 5
Badge +14

to handover multiple variables between/among workflows one can build a single XML message that holds all the variables to pass through.

then within workflows simple Query/Update XML can read and or change values of these variables.

Badge +16

great shout as always, ‌!

Badge +7

Thanks Cassy, 

Your willingness to come back later and write with such detail is very appreciated!

Thanks for clarifying that the Store/Retrieve is only applicable one way.

That's what I thought I was seeing with the Store action as well, and I agree that is quite limiting especially in a complex workflow.

I will upvote those ideas as well.

i agree that the child cant detect which workflow instance ID to retrieve data from parent. but beside store and retrieve data, is there any other possible way to pass value from parent WF to child WF? as my WF is really big so it is better to break it down to several smaller WF, easier to handle and maintain as well. 

i saw somewhere they use 'start data' in Start Action field but i dun find any 'Start data' field in my Start Action WF.

Hope to hear from you soon! Thank you!

Badge +16

Hi Jen

I think the start data is when your child workflow requires variables on start - does that make sense?

Hi Cassy,

is there any possible way to pass variable from parent to child WF?

Thank you!

Badge +16

Yes it is possible - are you able to post your specific requirements as a new question in ‌ and I (or someone else) will come back to you with some screenshots of how you may approach your problem. 

Badge +4

Hi Cassy,

I need small Clarification. Her eyou are trying to get the data from child (workflow which you started from main wf) to main (workflow from where u called child) right?

And Retrieve will be in Child workflow and Store / Start Workflows will be in Main workflow?? Am I correct. please correct me if I'm wrong! I'm not clear, It is so confusing for me. Please help. I need these actions in my workflow.

Thanks

Divya

Badge +16

the main workflow starts the child workflow.

the child workflow stores the data

the main workflow retrieves the data from the child workflow

Userlevel 6
Badge +15

Very useful post, thank you!

It's been a while, now ... do we have any way to pass information from parent to child?

Badge +16

yep - if you have "starting variables" in child you can add them in your start workflow action.

Badge +5

Thank you for your helpful article; I"m trying to adjust your idea with my workflow:

In my state: i need to send data from the main, workflow to the children.

the start workflow action is on the main workflow and not in the child WF. 

if I flow your process: I need to store data, the main WF; add the action start WF with the instance ID of Main WF.

when I go the child WF, I need to retrieve the data that I stored in the main. So here I'm facing a problem with the retrieve Data, i can't find the variable if instance ID in the child WF.

Any idea How can I proceed /

Thank you .

Badge +5

can you ^please give more information about the" build a single XML message" and how can we used in the childWorkFlow.

Userlevel 5
Badge +14

just build up your own XML message that you will handover among workflows. the structure is fully up to you.

it may eg look like

<?xml version="1.0" encoding="utf-8"?>
<Variables>
  <Title>this is title</Title>
  <Name>this is name</Name>
  <Department>this is department</Department>
</Variables>
Badge +1

Hello Cassy,

I appreciate your dedication and support as a followup to very uselful article. I am calling a child workflow and trying to pass three parameters from the parent (Person, 4 strings) but the child wf log shows them empty therefore the Task assignment fails. Any idea/tip what am I missing here. Cassy Freeman

Passing parameters (start form) to child workflow

Badge +16

Looks fine to me.  are you sure those have values in them?  (Form No, Approver3, Approver3ID, Approver3Name)?

Can you log to history just before your start workflow action to check?

Badge +1

Yes they do have values and I spitted them on both sides and parent was logging but not the child. So, I decided to create a miniature version of it teeny tiny form by passing in different data types and it was working. Reverted back to the project deleted the start workflow component and reconfigured and published and its working now.

Thanks,

Badge +1

I thought it had resolved but some approval lines still had the issue and after comparison I found that the Task Name which I was building with static and dynamic text was causing issues and once changed to static text the issue resolved for good.

Reply