Pass WorkFlow data from one custom step to another | Community
Skip to main content
October 16, 2015
Solved

Pass WorkFlow data from one custom step to another

  • October 16, 2015
  • 5 replies
  • 3078 views

Wondering how to persist workflow data from one step to another.

From my understanding we use the following code to save the workflow data for the second step:

 

public void execute(WorkItem item, WorkflowSession session, MetaDataMap args) throws WorkflowException {
         
    MetaDataMap wfd = item.getWorkflow().getMetaDataMap();
 
    wfd.put("mykey", "My Step Value");
         
    Set<String> keyset = wfd.keySet();
    Iterator<String> i = keyset.iterator();
    while (i.hasNext()){
        Object key = i.next();
        log.info("The workflow medata includes key {} and value {}",key.toString(),wfd.get(key).toString());
    }
}

 

How do you retreive the data from the second custom step?

 

Thanks,

Ram

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Scott_Brodersen

The MetaDataMap object contains all of the workitem data. The key/value pair is one item of data. So, you would add each data item that you are handling to the object. 

Perhaps you could describe in more detail what it is you are implementing and we could help you more directly?

scott

5 replies

smacdonald2008
Level 10
October 16, 2015
October 16, 2015

Sorry, took a look at that AEM topic and it didn't have anything on pass workflow data between custom processes.

Scott_Brodersen
Level 8
October 16, 2015
October 16, 2015

Sorry can't seem to wrap my head around this.

The following line of code:

wfd.put("mykey", "My Step Value");

 

What exactly is "my step value"? Workflow Item/Data?

If someone can show me an example that would be greatly appreciated.

Thanks

Scott_Brodersen
Scott_BrodersenAccepted solution
Level 8
October 16, 2015

The MetaDataMap object contains all of the workitem data. The key/value pair is one item of data. So, you would add each data item that you are handling to the object. 

Perhaps you could describe in more detail what it is you are implementing and we could help you more directly?

scott