Expand my Community achievements bar.

SOLVED

Workflow failing in the second iteration

Avatar

Level 2

ISSUE:

The workflow we require is a multi-approval workflow which means once the author create the content it gets reviewed and approved by 2 roles (First by a Brand Manager and then finally by a Brand Director). The workflow works as expected if both Brand Manager and the Brand Director approves the content in the first go. However in a specific case where the Brand director is rejecting the content the 2nd iteration breaks. Below is the flow which is breaking (Steps to reproduce):

  1. Editor create the content and send it to Brand Manager for approval. (Use any geometrixx page. Put it in the workflow and from the inbox assign it to manager.)
  2. Brand Manager approves it and send it to Brand Director for the final review.
  3. Brand Director rejects the content. (For the rejection process we are using a custom process. The source code for the same is in the attached bundle. We tried using the go to step available with 5.6.1 but it doesn't seems to work.)
  4. The content is now back with the editor with the rejection comment.
  5. The editor changes the content and send it back to the Brand Manager.
  6. The Brand Manager approves the content and send it to the Brand Director for the final approval.
  7. At this step the Brand director is unable to do anything. He is not able to approve/reject the content.

 Package details:

I do have a package which one can use as is to reproduce the issue on a vanilla instance of AEM 5.6.1. However just learned that i cant attach a zip file in this forum. Anyone willing to help me please reply back and i can share the package by any possible way.

Screenshot:

Here is the screenshot of our workflow model.

 [img]acme workflow.PNG[/img]

Appreciate any help in investigating or suggesting if anyone has achieved a similar flow using a different approach.

thanks,
Himanshu

1 Accepted Solution

Avatar

Correct answer by
Level 2

Hi Kish,

Thanks for asking the question. Gives me an opportunity to get this thread to a logical conclusion. Adobe finally provided a hotfix to resolve the issue. The hotfix number is NPR-3850.

You can check the hotfix details at https://helpx.adobe.com/experience-manager/kb/cq561-available-hotfixes.html and request adobe for the same.

thanks,

Himanshu

View solution in original post

11 Replies

Avatar

Employee

Hi,

Can you explain why the built-in GOTO step for 5.6.1 did not work?  

As for looking at this in great detail, the best thing for you to do is log a daycare ticket so it gets prioritized properly.

Thanks,

Will

Avatar

Level 10

hope you are using granite api. What is the error. You can provide link of zip file by attaching at sendnow https://www.acrobat.com/sendnow/en/home.html

Avatar

Level 2

Thanks for the quick response Will and Sham.

@Will, I tried using the GOTO step at the beginning but it simply didn't work for us. Since we used a custom process in the previous project (CQ5.5) we adopted the same approach. I have raised an adobe ticket for the same and the support person suggested me to reach out to these forums for experts opinion.

@Sham, Not sure i am answering your question correctly but in our workflow model we have used out of the box participant steps and one custom process which is written by extending com.day.cq.workflow.exec.WorkflowProcess. There are no errors in the logs. I have tried sending the zip to myself using sendnow and the same is available https://sendnow.acrobat.com/?i=0qQDXD96okHMRHyhbIYiYA

Package Details:

acme-editorial-workflow.zip is the package which contains workflow model, user-groups, users associated with the groups and access permissions.

While importing please make sure that the Access Control Handling option is set to Overwrite (this should populate automatically as i have taken care of this while building the package.)

the users are 'editor', 'manager', 'director'. Password for all of them is 'password'.

Once again really appreciate your help on this.

thanks,

Himanshu

Avatar

Level 10

Had a quick look at code. Seems you are still using com.day.cq.workflow please use granite api.

Avatar

Level 2

Hi Sham,

I rewrote the class using the granite APIs but that didn't solve the issue. The behavior remains exactly the same.

Thanks,

Himanshu

Avatar

Level 10

Hi Himanshu,

Can you send your latest package. Let me try in local instance.

Thanks,
Sham

Avatar

Level 3

Hi Himanshu,

I am using Adobe CQ5.5. I am also writing similar kind of Use Case but OOTB Step Back and Delegate are not working for the second Iteration. I used all OOTB steps. I used Workflow Initiator Script for Rejection. Can you explain about your Custom Step written for Adobe CQ5.5. Please let me know or can you share the sample code so that i can go through that as an reference.

Thanks a lot in advance

Avatar

Correct answer by
Level 2

Hi Kish,

Thanks for asking the question. Gives me an opportunity to get this thread to a logical conclusion. Adobe finally provided a hotfix to resolve the issue. The hotfix number is NPR-3850.

You can check the hotfix details at https://helpx.adobe.com/experience-manager/kb/cq561-available-hotfixes.html and request adobe for the same.

thanks,

Himanshu

Avatar

Level 3

Thank You so much for the information Himanshu. This helps.

As of now i a using Adobe CQ5.5. I am not sure if this hotfix solves the issue in 5.5. 

If you can provide an idea how you managed to write custom step for CQ5.5 . can you share the code if possible?

Avatar

Level 2

Hi,

I doubt that this hotfix will work for 5.5 as the issue certainly doesn't exist on 5.5. That said i think you can't use the OOTB goto with 5.5. As far as i remember it never worked for us. the GoTo step of 5.6 on the other hand works just fine. Now since we are on 5.6.1 we are using the OOTB GoTo process. I could find a old reference of this class and providing the same here. You may have to change few things here and there.

 

Cheers,

Himanshu

package com.acme.dmp.core.workflow; import java.util.List; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Properties; import org.apache.felix.scr.annotations.Property; import org.apache.felix.scr.annotations.Service; import org.osgi.framework.Constants; import com.day.cq.workflow.WorkflowException; import com.day.cq.workflow.WorkflowSession; import com.day.cq.workflow.exec.Route; import com.day.cq.workflow.exec.WorkItem; import com.day.cq.workflow.exec.WorkflowData; import com.day.cq.workflow.exec.WorkflowProcess; import com.day.cq.workflow.metadata.MetaDataMap; /** * * Routes the workflow to specific Route. */ @Component @Service @Properties({ @Property(name = Constants.SERVICE_DESCRIPTION, value = "Go To Specific Step Process."), @Property(name = "process.label", value = "Go To Specific Step Process") }) public class GoToSpecificStepProcess implements WorkflowProcess { /** * JCr_PATH. */ private static final String TYPE_JCR_PATH = "JCR_PATH"; /** * Routes the workflow to specific Route publishing. * * @param item *            the item * @param session *            the session * @param args *            for the args entered by user * * @throws WorkflowException *             the workflow exception */ @Override public final void execute(final WorkItem item, final WorkflowSession session, final MetaDataMap args) throws WorkflowException { final WorkflowData workflowData = item.getWorkflowData(); if (workflowData.getPayloadType().equals(GoToSpecificStepProcess.TYPE_JCR_PATH)) { goToStep(item, session, this.readArgument(args)); } } /** * Read input arguments. * * @param args *            the args * @return the string */ private String readArgument(final MetaDataMap args) { return args.get("PROCESS_ARGS", "false"); } /** * This method is used to get the specific step. * * @param item *            WorkItem * @param session *            WorkflowSession * @param targetRouteName *            step name * @throws WorkflowException *             workflowException * */ public static void goToStep(final WorkItem item, final WorkflowSession session, final String targetRouteName) throws WorkflowException { try { final List<Route> previousSteps = session.getBackRoutes(item); if (previousSteps.isEmpty()) { throw new WorkflowException("No previous steps available."); } Route step = null; step = getStep(targetRouteName, previousSteps, step); if (step != null) { session.complete(item, step); } } catch (final WorkflowException we) { throw new WorkflowException(we); } } /** * This method is used to get the specific step. * * @param targetStepName *            Name of the target step * @param step *            Route * @param previousSteps *            all possible backsteps * @return returns the step * */ private static Route getStep(final String targetStepName, final List<Route> previousSteps, Route step) { if (targetStepName !=null) { step = previousSteps.get(0); } else { for (final Route backStep : previousSteps) { final String routeName = backStep.getName(); if (routeName.equals(targetStepName)) { step = backStep; break; } } } return step; } }