Expand my Community achievements bar.

SOLVED

AEM Component with drop-down values coming from data source. Need to send the payload/pagepath when clicked on the dialog

Avatar

Level 3

Hello,

I have a dialog with drop-down values coming from data source. As it is used across the site I need to get the "page path" when I click on the dialog.

So is there a way to send the page path/payload when clicked on the dialog.

Thanks,

Adithya.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Are you able to get workflow instance in Java? if yes then you can read payload from there when you access from inbox.

Otherwise do with javascript

1. you can read data-payload-link attribute and fetch payload part using path

data-payload-link="/bin/wcmcommand?cmd=open&path=%2Fcontent%2FAEM63App%2Ffr%2FtestJS&_charset_=utf-8"

decodeURIComponent("%2Fcontent%2FAEM63App%2Ffr%2FtestJS")

2. on dialog load you can read this and make an ajax request to pull dropdown option and create dropdown using javascript.



Arun Patidar

View solution in original post

5 Replies

Avatar

Community Advisor

Hi,

You can get the page path inside dialog or send to datasource. But I didn't understand when and where you need page path. Could you please explain in detail?



Arun Patidar

Avatar

Level 10

You haven't mentioned touch or classic ui and other details...

If you want to perform any action or get something on click of dialog button, you would need to add listeners to the dialog. For page path, you could use $PATH or CQ.WCM.getPagePath() or some other way

check -

Adobe Experience Manager Help | Using Event Handlers in Adobe Experience Manager Touch UI Components

Experiencing Adobe Experience Manager - Day CQ: AEM 6 SP2 - Sample Datasource Touch UI Select Listen...

https://aemcorner.com/add-listeners-to-widgets-in-cq5/

Experiencing Adobe Experience Manager - Day CQ: In the blog "Experiencing Adobe Experience Manger - ...

Avatar

Level 3

Hello Arun,

In workflow participant step I wanted to show list of Approvers. The approver list  will change based on the payload (page) belongs to which site(site based approvers).I am getting the approvers list form the custom AEM user Group through a data source populated as drop down.

When I am opening the payload and  try to complete the workflow step, I am getting the current page path by using

Enumeration values = getRequest().getHeaders(REFERER);

if (values != null)

{

   while (values.hasMoreElements())

  { pagePath = (String) values.nextElement();

  }

}

But when I am trying to complete the workflow step directly from AEM Inbox, then I am not getting any information about the payload in the data source code because the page path as localhost:4502/aem/inbox.

I am trying to achieve the above

Avatar

Correct answer by
Community Advisor

Are you able to get workflow instance in Java? if yes then you can read payload from there when you access from inbox.

Otherwise do with javascript

1. you can read data-payload-link attribute and fetch payload part using path

data-payload-link="/bin/wcmcommand?cmd=open&path=%2Fcontent%2FAEM63App%2Ffr%2FtestJS&_charset_=utf-8"

decodeURIComponent("%2Fcontent%2FAEM63App%2Ffr%2FtestJS")

2. on dialog load you can read this and make an ajax request to pull dropdown option and create dropdown using javascript.



Arun Patidar

Avatar

Level 3

arunpatidar26

Javascipts are not working as expected int the workflow. I am not able to get the payload value too into my Java Class.