Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Issue with setting custom metadata within a workflow

Avatar

Level 1

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

1 Accepted Solution

Avatar

Correct answer by
Level 10

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.

View solution in original post

4 Replies

Avatar

Level 10

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

Avatar

Correct answer by
Level 10

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.