Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

CQ5 workflow content inbox | Approve folder content wrong url

Avatar

Level 1

We have created a workflow to send approval mail to approver. The payload is jcr:content of a folder or a PDF.
After the coding, the behaviour is for:
A pdf : It generate right URL as http:///damadmin.html#/content/ab/cd/abc.pdf
A folder : It generate the wrong url as /content/folder-name/jcr:content

So, for folder, we have updated the code to change the payload as the folder-path instead of folder-path/jcr:content
for that we used,

WorkflowData wfData = wfSession.newWorkflowData("JCR_PATH", folder_node_path); wfSession.updateWorkflowData(workItem.getWorkflow(), wfData);

After the code change, 
When a user modify any dam content like a pdf, the url is correct as http:///damadmin.html#/
but when the user modify a folder properties, the mail sent to approver has the wrong url as http:///

means /damadmin.html# is missing.

We need that the correct link should be added for both PDF and Folder. Thanks in advance.

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi,

check the method "getPayloadPath" in libs/cq/workflow/global.jsp it might give you a hint as to how to generate an url for a payload path.

CQ uses something called "JcrPathBuilderManager" to turn a payload path in the repository into an url you can click on.  You should be using this in your code too.

See the following [0] and  [1] for some ideas.

Hope this helps,

Will

[0] http://stackoverflow.com/questions/23787369/implement-inbox-functionality-in-custom-cq-component

[1] https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/workflow/ui/JcrPathBuilderManager.html

View solution in original post

4 Replies

Avatar

Level 10

Check the email template & fix there instead at workflow step.

Avatar

Level 1

Sham,

Thanks for the reply.

The inbox url is http://localhost:4502/libs/cq/workflow/content/inbox.html

So, using this, I reached to /libs/cq/workflow/content/inbox page and checked the following files in CRX:

            File                                                                :                 Template

  1. /libs/cq/workflow/content/inbox                           :                 /libs/cq/ui/components/widget/html.jsp
  2. /libs/cq/workflow/content/inbox/list                      :                 /libs/cq/workflow/components/inbox/list/json.jsp
  3. /libs/cq/workflow/content/inbox/authorizables       :                 /libs/cq/workflow/components/inbox/authorizables/json.jsp
  4. /libs/cq/workflow/content/inbox/models                :                 /libs/cq/workflow/components/inbox/models/json.jsp
  5. /libs/cq/workflow/content/inbox/steps                   :                /libs/cq/workflow/components/inbox/steps/json.jsp

But I could not get the code where the link is created. 

If you could suggest me any page or path in CRX, which may have the code, it would be a great help.

Thanks in advance 

Gagan

Avatar

Correct answer by
Employee

Hi,

check the method "getPayloadPath" in libs/cq/workflow/global.jsp it might give you a hint as to how to generate an url for a payload path.

CQ uses something called "JcrPathBuilderManager" to turn a payload path in the repository into an url you can click on.  You should be using this in your code too.

See the following [0] and  [1] for some ideas.

Hope this helps,

Will

[0] http://stackoverflow.com/questions/23787369/implement-inbox-functionality-in-custom-cq-component

[1] https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/workflow/ui/JcrPathBuilderManager.html

Avatar

Level 1

Will,

Thanks for the reply.

I could not get any method "getPayloadPath" in libs/cq/workflow/global.jsp

But, I got 'pathBuilder' in /libs/cq/workflow/components/inbox/list/json.jsp.

I wrote a method which will add '/damadmin.html#' as prefix, if it is not added to URL by 'pathBuilder'.

-------------------------------------------------

 private String handleDamPathForFolder(Logger log, String payloadUrl, Session session, WorkItem wi)
    {
        try
        {
            if(isFolderNode(session, wi))
            {
                return ("/damadmin.html#"+payloadUrl);
            }
        }catch (Exception e) 
        {
            log.error("Unable to handle path creation for work item: " + wi.getId(), e);
        }
        return payloadUrl;
    }

------------------------------------

Also, we dont need to change the  payload as the folder path, CQ handles it.

Anyway, the URL problem is resolved.

But, now I want to

1. select a child folder by CQ javascript API(Attached the PDF of screenshots.)

In the PDF(Heading as 'folder selection'), we can see the second child folder is selected.

2. open the folder properties as pop up.

In the PDF(Heading as 'folder properties pop up'), we can see the popup.

Both requirements should be done by code and page onload.

 

Thanks in advance to all