Get property Arguments in the Workflow | Community
Skip to main content
jo-facic
Level 2
October 16, 2015
Solved

Get property Arguments in the Workflow

  • October 16, 2015
  • 2 replies
  • 3743 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

You can get process arguments by using this API:

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

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

2 replies

Level 3
October 16, 2015

I found this example quite easy to follow. It should be a good starting point

URL - http://labs.sixdimensions.com/blog/2014-10-14/creating-custom-CQ-workflow-process-step/

smacdonald2008
smacdonald2008Accepted solution
Level 10
October 16, 2015

You can get process arguments by using this API:

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

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