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
BedrockMission!

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.

Avatar

Avatar
Validate 1
Level 1
akashdhawle
Level 1

Likes

0 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Applaud 5
View profile

Avatar
Validate 1
Level 1
akashdhawle
Level 1

Likes

0 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Applaud 5
View profile
akashdhawle
Level 1

27-06-2019

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. 

Replies

Avatar

Avatar
Establish
Level 6
antoniom5495929
Level 6

Likes

91 likes

Total Posts

212 posts

Correct Reply

39 solutions
Top badges earned
Establish
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Establish
Level 6
antoniom5495929
Level 6

Likes

91 likes

Total Posts

212 posts

Correct Reply

39 solutions
Top badges earned
Establish
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile
antoniom5495929
Level 6

28-06-2019

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

Avatar

Avatar
Validate 1
Level 1
akashdhawle
Level 1

Likes

0 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Applaud 5
View profile

Avatar
Validate 1
Level 1
akashdhawle
Level 1

Likes

0 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Applaud 5
View profile
akashdhawle
Level 1

28-06-2019

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 

Avatar

Avatar
Establish
Level 6
antoniom5495929
Level 6

Likes

91 likes

Total Posts

212 posts

Correct Reply

39 solutions
Top badges earned
Establish
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Establish
Level 6
antoniom5495929
Level 6

Likes

91 likes

Total Posts

212 posts

Correct Reply

39 solutions
Top badges earned
Establish
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile
antoniom5495929
Level 6

28-06-2019

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);

}

return SC_INTERNAL_SERVER_ERROR;

Let me know.

Thanks,

Antonio