Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Issue with setting custom metadata within a workflow

banuarslan
Level 1
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
Sham_HC
Correct answer by
Level 10
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
smacdonald2008
Level 10
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

Sham_HC
Correct answer by
Level 10
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