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

Configure Schedule Publish in Content Approval Workflow

Avatar

Level 2

We have a simple content approval workflow where authors can trigger the workflow once done with the changes. Now approvers group gets the notification and they can go and approve the content and complete the workflow that publishes the pages right away.

We got the requirement from the approvers that they want to have an option to schedule the publication. So basically, what they are looking for is that they can complete/approve the workflow but don't want to publish the pages right away. They want to complete/approve the workflow with schedule publication. So if approved, those pages should be published at the scheduled date and time.

Is there any OOTB functionality of workflow that we utilize to achieve this? Or is there any other way we can achieve this?

Thank you!

 

1 Accepted Solution

Avatar

Correct answer by
Level 3

Hi @webdev91 

This can be possible using following steps in the workflow.

1. Dialog Participant Step

  • This step helps content author to choose the page activation date.
  • Created a dialog under /etc/workflow for capturing data/time from content author.
  • Captures widget data and stores as a name property of the workflow payload as “./jcr:content/scheduleddate”

2. Capture Scheduled date/time (Process Step): 

  • It saves the date selected in dialog participant step as "absoluteTime" in metadata of the workflow instance.

Code Snippet for Reference:

      Resource resource = resourceResolver.getResource(contentPagePath + "/jcr:content");          

      ValueMap valueMap = resource.getValueMap();     

      Calendar calendar = (Calendar)valueMap.get("scheduleddate", Calendar.class);

      item.getWorkflowData().getMetaDataMap().put("absoluteTime", Long.valueOf(calendar.getTimeInMillis()));

3. Waiting for Activation (Participant Step):

  • This step will wait until the scheduled time is reached and proceed to the next step.
  • Selecting Timeout as Immediate and Timeout handler as "Absolute Time Auto Advancer" in Timeout Settings of step properties.
  • Optional - Automated-user can be created and assigned for this step, so that the waiting process won’t be manually completed unknowingly by the content author or content approver before the scheduled date/time is reached.

4. Activate Page (Process Step): 

  • Activates the page when scheduled time is reached.   

 

Hope this help!

View solution in original post

2 Replies

Avatar

Correct answer by
Level 3

Hi @webdev91 

This can be possible using following steps in the workflow.

1. Dialog Participant Step

  • This step helps content author to choose the page activation date.
  • Created a dialog under /etc/workflow for capturing data/time from content author.
  • Captures widget data and stores as a name property of the workflow payload as “./jcr:content/scheduleddate”

2. Capture Scheduled date/time (Process Step): 

  • It saves the date selected in dialog participant step as "absoluteTime" in metadata of the workflow instance.

Code Snippet for Reference:

      Resource resource = resourceResolver.getResource(contentPagePath + "/jcr:content");          

      ValueMap valueMap = resource.getValueMap();     

      Calendar calendar = (Calendar)valueMap.get("scheduleddate", Calendar.class);

      item.getWorkflowData().getMetaDataMap().put("absoluteTime", Long.valueOf(calendar.getTimeInMillis()));

3. Waiting for Activation (Participant Step):

  • This step will wait until the scheduled time is reached and proceed to the next step.
  • Selecting Timeout as Immediate and Timeout handler as "Absolute Time Auto Advancer" in Timeout Settings of step properties.
  • Optional - Automated-user can be created and assigned for this step, so that the waiting process won’t be manually completed unknowingly by the content author or content approver before the scheduled date/time is reached.

4. Activate Page (Process Step): 

  • Activates the page when scheduled time is reached.   

 

Hope this help!

Avatar

Level 2

Hi @Ganthimathi

Thanks for your quick response.

Would you please provide the complete code for the second step?