Expand my Community achievements bar.

SOLVED

Pass WorkFlow data from one custom step to another

Avatar

Former Community Member

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

1 Accepted Solution

Avatar

Correct answer by
Level 8

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

View solution in original post

5 Replies

Avatar

Former Community Member

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

Avatar

Former Community Member

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

Avatar

Correct answer by
Level 8

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