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.
Views
Replies
Total Likes
Hi,
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.
Thanks,
Antonio
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.
Thanks,
Akash
Views
Replies
Total Likes
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:
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);
}
return SC_INTERNAL_SERVER_ERROR;
Let me know.
Thanks,
Antonio
Views
Likes
Replies