Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Values are not getting saved under metaData under var/workflows

Avatar

Level 2

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.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

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 ");

View solution in original post

2 Replies

Avatar

Correct answer by
Employee Advisor

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 ");

Avatar

Community Advisor

Hi, 

The dialog dialog participant step stores the value in payload node, not in workflow instance node. If you need this property only in the workflow then you can get ti from history or directly from payload.



Arun Patidar