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

Can I apply workflow for approval of editable template that author is going to enable.


Level 1

I have a scenario like after creation of editable template, When author is going to enable it then only after approval that template should get enabled for creating pages. Can you please suggest me the approach if this is possible. 

1 Reply


Level 7


I think you can do it just by customizing the view.

You can:

- customize the enable button by createing in apps the same of /libs/wcm/core/content/sites/templates/jcr:content/actions/selection/enabletemplate, in order to make a call to your servlet with run a workflow instance of your workflow model of approval

- if the changes are approved, into a custom workflow step you can set the status to enabled in template path ( e.g. /conf/we-retail/settings/wcm/templates/mytemplate/jcr:content)

Let me know if you need more info.




Level 1

Hi Antonio,

Thank you for the reply.

1. As, Enable option is present default in the tool,  how should I make it customized through apps. (for giving servlet call to run workflow)

2. Is there any way by which I can get the current template(which is to be enabled) path in servlet so that I can pass it to the workflow.




Level 7

Hi Akash,

By points:

1. You just need to go into the path, right click and select "Overlay Node..." this is the standard approach used in order to customize some elements in AEM. After overlay this node, you have multiple choice:

  1. Create a new actions property to send data in a custom servlet
  2. Remove the action property and use a javascript loaded into cq.authoring categories in order to attach an event to your button and make the ajax by sending also selected template as parameter

2. Into your servlet you need to run an instace of your custom model by using the following snippet and based on a payload which need to be the path of your template

ResourceResolver resourceResolver = null;

try {

  resourceResolver = ResourceUtils.getResourceResolver(resourceResolverFactory);

   session = resourceResolver.adaptTo(Session.class);

  WorkflowSession wfSession = workflowService.getWorkflowSession(session);

  WorkflowModel wfModel = wfSession.getModel(workflowName);

  WorkflowData wfData = wfSession.newWorkflowData(JCR_PATH_WF_PROPERTY, workflowContent);

  wfSession.startWorkflow(wfModel, wfData);

   return SC_ACCEPTED;

} catch (WorkflowException e) {

   LOGGER.error(e.getMessage(), e);



Let me know.