Values are not getting saved under metaData under var/workflows

Avatar

Avatar

prathik-sm

Avatar

prathik-sm

prathik-sm

05-01-2021

Hi Team,

 

We have custom dialog which will be used in the dialog participant step.

 

Case 1: Saving under data/metaData (helpful in accessing across different steps under same workflow) The fields in this dialog needs to be saved under metaData as we need them in the further steps. So we are storing the field like ./metaData/watchEmails We see that values are not getting saved under metaData(/var/workflow/instances/server0/2021-01-04/new-model_26/data/metaData)

Case 2: Saving under history metaData (specific to workitem) If we save the field like 'watchEmails' then it is getting saved under (/var/workflow/instances/server0/2021-01-04/new-model_26/history/1609766229181/workItem/metaData)

Case 3: Saving under payload If we save the field like './jcr:content/watchEmails' then it will be saved under payload 

 

Kindly help us in storing the fields as mentioned in Case 1 - It would be helpful in accessing the value across other steps.

View Entire Topic

Avatar

Avatar

kunal23

MVP

Avatar

kunal23

MVP

kunal23
MVP

05-01-2021

You should go with case #2 and access the stored data in subsequent process steps using workflow history API- 

 

Example-

List<HistoryItem> historyItemList = workflowSession.getHistory(workItem.getWorkflow());
HistoryItem currentItem = historyItemList.get(historyItemList.size() - 1);
HistoryItem prevItem = currentItem.getPreviousHistoryItem();

String str = prevItem.getMetadataMap().get("watchEmails ");