Expand my Community achievements bar.

SOLVED

Call scheduler from aem workflow

Avatar

Level 2

Hi 

 

i have a custom workflow in place… where i am getting the content approved and after approval, i have custom process step - CustomActivationProcess implements workflowprocess

 

…. some logic…

then i am replicating the payload right away..

 

but now i want to schedule this replication… from this payload/jcr:content i am getting ontime property.. and i want to schedule replication at this ontime…

 

Another class i have written is scheduler class which will schedule replication for any given pagepath…

 

Now actual pagepath is in process class… can i call scheduler from there ? How

 

or is there any better way to acheive this …

but i have to use ontime property only to get scheduled replication time.

1 Accepted Solution

Avatar

Correct answer by
Level 5

Trigger or schedule the job from the workflow process.

If you are using a sling job, you can use the job scheduler - https://sling.apache.org/documentation/bundles/apache-sling-eventing-and-job-handling.html#scheduled...

and trigger at the specific date and time using this - https://sling.apache.org/apidocs/sling7/org/apache/sling/event/jobs/JobBuilder.ScheduleBuilder.html#...

 

View solution in original post

3 Replies

Avatar

Correct answer by
Level 5

Trigger or schedule the job from the workflow process.

If you are using a sling job, you can use the job scheduler - https://sling.apache.org/documentation/bundles/apache-sling-eventing-and-job-handling.html#scheduled...

and trigger at the specific date and time using this - https://sling.apache.org/apidocs/sling7/org/apache/sling/event/jobs/JobBuilder.ScheduleBuilder.html#...

 

Avatar

Level 2

Thanks it worked

Avatar

Community Advisor

Hi @Suman589 

 

Just to confirm my understanding—

You have a review workflow, and after the review is completed, you want to schedule the activation of the page via the workflow. That means the page should only be activated at the scheduled time you’ve selected. I’m assuming you’re capturing the date and time in a dialog during a previous step. If that’s the case, you can use the absoluteTime property to set the activation time. This is exactly how it works when you trigger Manage Publication—a workflow is triggered in the background, which sets the time for scheduled activation.

 

By the way, if the above understanding is correct, you don’t need a scheduler—you can simply delay the activation using the workflow itself.

 

You can check out this blog for details on how to set the time programmatically:
https://medium.com/@ganthisblog/aem-custom-workflow-scheduled-content-activation-31ddd092ef3f

 

Thanks,
Veena