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:
- Create a new actions property to send data in a custom servlet
- 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);
}
return SC_INTERNAL_SERVER_ERROR;
Let me know.
Thanks,
Antonio