AEM 6.4 Workflow - Assign Task - Advanced - Use custom Metadata - ECMA getUserMetaData() - how to get Workflow Metadata .. workItem Error

Avatar

Avatar

wendelinfa

Avatar

wendelinfa

wendelinfa

18-08-2020

We try to use Workflow Metadata inside Assign Task notification eMail.

 

Sample https://docs.adobe.com/content/help/en/experience-manager-64/forms/publish-process-aem-forms/use-met... is working fine.

 

When using var wfmetadata = workItem.getWorkflow().getMetaDataMap(); 

witch is working in participantChoser getParticipant() we get error

/apps/fd/dashboard/scripts/metadataScripts/kpbTaskMetaData_v1.ecma: ReferenceError: "workItem" is not defined. (NO_SCRIPT_NAME#28)

 

Please advice how to get Workflow Metadata based on ECMA Script in Assign Task

 

Thanks for any help

 

Regards Wendelin

View Entire Topic

Avatar

Avatar

gbedekar

Avatar

gbedekar

gbedekar

19-08-2020

this is working in the ecma script

var workflowData = workItem.getWorkflowData();

var payloadPath = workItem.getWorkflowData().getPayload().toString();

log.info("The path is "+payloadPath);

Once you get the payloadPath, you can acces the submitteddata and from there do the rest

I recommend creating osgi service to do this

Let us know if you have problems