Expand my Community achievements bar.

SOLVED

Get property Arguments in the Workflow

Avatar

Level 2

Hi,

I'm implementing the interface  WorkflowProcess and I need to recover the property "arguments" what i set in the my workflow (see image).

@ Override
     public void execute (WorkItem WorkItem, WorkflowSession workflowSession, MetaDataMap metaDataMap) throws WorkflowException {
}

the examples I found on the internet no work.
Could someone help me?

 

Thank's in advanced

1 Accepted Solution

Avatar

Correct answer by
Level 10

You can get process arguments by using this API:

https://docs.adobe.com/docs/en/cq/current/javadoc/com/adobe/granite/workflow/exec/WorkflowProcess.ht...

The following Java code is the execute method for a WorkflowProcess implementation. The method logs the value in the args MetaDataMap that is associated with the PROCESS_ARGS key.

public void execute(WorkItem item, WorkflowSession session, MetaDataMap args) throws WorkflowException {

        if (args.containsKey("PROCESS_ARGS")){
            log.info("workflow metadata for key PROCESS_ARGS and value {}",args.get("PROCESS_ARGS","string").toString());
        }       
    }

See this AEM doc topic:

http://helpx.adobe.com/experience-manager/using/creating-custom-aem-workflow-steps.html

To learn how to write a custom OSGi bundle that uses this API to create a workflow step -- see this community article:

http://helpx.adobe.com/experience-manager/using/creating-custom-aem-workflow-steps.html

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

You can get process arguments by using this API:

https://docs.adobe.com/docs/en/cq/current/javadoc/com/adobe/granite/workflow/exec/WorkflowProcess.ht...

The following Java code is the execute method for a WorkflowProcess implementation. The method logs the value in the args MetaDataMap that is associated with the PROCESS_ARGS key.

public void execute(WorkItem item, WorkflowSession session, MetaDataMap args) throws WorkflowException {

        if (args.containsKey("PROCESS_ARGS")){
            log.info("workflow metadata for key PROCESS_ARGS and value {}",args.get("PROCESS_ARGS","string").toString());
        }       
    }

See this AEM doc topic:

http://helpx.adobe.com/experience-manager/using/creating-custom-aem-workflow-steps.html

To learn how to write a custom OSGi bundle that uses this API to create a workflow step -- see this community article:

http://helpx.adobe.com/experience-manager/using/creating-custom-aem-workflow-steps.html