Issue with setting custom metadata within a workflow | Community
Skip to main content
October 16, 2015
Solved

Issue with setting custom metadata within a workflow

  • October 16, 2015
  • 4 replies
  • 1711 views

I need to create a custom activate later workflow. In order to accomplish that, I wrote a component dialog that allows the author to enter the date/time for the activate later to use.

<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
    jcr:primaryType="cq:Dialog"
    title="Activate Later"
    xtype="dialog">
    <items jcr:primaryType="cq:WidgetCollection">
        <actdatetime
            jcr:description="This is for creating responsive pages "
            jcr:primaryType="cq:Widget"
            fieldDescription="Indicate time and day"
            fieldLabel="Activation Date"
            name="./metaData/absoluteTime"
            xtype="datetime"/>
    </items>
</jcr:root>

I am using dialog participant step workflow component and referencing this dialog in the workflow. I am unable to save the absoluteTime field as metadata. Do you have any suggestions to save this? I can attach the workflow if it helps.

Thank you,
Banu

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 Sham_HC

Assume wf = workflow instance

The api call would be

WorkflowData data = wf.getWorkflowData();
data.getMetaData().put("absoluteTime", "12341234"); <= replace 12341234 with your calculated absolute time as a string.

4 replies

smacdonald2008
October 16, 2015

You can write a custom step to save any value you want to a JCR node. By creating a custom workflow step that uses the JCR API, you will have finer control over creating, replacing, updating, and deleting JCR node props. If you do not know how to create a custom step - see:

http://scottsdigitalcommunity.blogspot.ca/2013/10/creating-custom-aem-workflow-steps-that.html

Sham_HC
Sham_HCAccepted solution
October 16, 2015

Assume wf = workflow instance

The api call would be

WorkflowData data = wf.getWorkflowData();
data.getMetaData().put("absoluteTime", "12341234"); <= replace 12341234 with your calculated absolute time as a string.

October 16, 2015

Me too  thank for share!.

October 16, 2015

Me too  thank for share!.