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

Dialog property retrieval on page via sightly

Avatar

Level 9

Hi All.

Doubt as below :

In component.html, we have a section as below :

<div class="col-xs-12 col-md-6" data-sly-test="${currentPage.title}">

<a href="something.pdf" class="icon-link doc_link_more"><span data-fi-lb>View  ${currentPage.title}</span></a>

  </div>

1] Here if I try with the above, it works fine and getting me the page title value.

2] However, if I try with another custom property at the page jcr:content level[i.e, at sme level where title is present] and of type "String" only, it is not displaying anything.

3] Also, there are couple of dialog properties[of type "String"] that I have to retrieve, which is also not coming up on the page.

Any thoughts/pointers on this will be really helpul.

desktop_exl_promo_600x100_weknowyou.png

1 Accepted Solution

Avatar

Correct answer by
Level 10

Why are you trying.. "${currentPage.properties.customproperty}"

You should use "${properties.customproperty}"

View solution in original post

12 Replies

Avatar

Level 10

 Also, there are couple of dialog properties[of type "String"] that I have to retrieve, which is also not coming up on the page.

See this article: 

https://helpx.adobe.com/experience-manager/using/creating-sightly-component.html

For other questions - read here: 

https://docs.adobe.com/docs/en/aem/6-0/develop/sightly.html

Related Articles

Sightly Introduction part 1
Sightly Introduction part 2
Sightly Introduction part 3
Sightly Introduction part 4
Sightly Introduction part 5
Sightly and Client Libraries
Sightly and Date Formatting

Hope this helps. 

Avatar

Level 10

you can access a value like

${ properties['jcr:title'] }

OR

${ properties.jcr:title }

However, I would insist you to share the exact piece of code you are trying to use.

Take a look at http://blogs.adobe.com/experiencedelivers/experience-management/sightly-intro-part-3-2/

Avatar

Level 9

Hi edubey,

Thank you or your reply.

I have posted the portion of html code that I am trying to make use of.

Very strange, but with the option you mentioned it is not working but working only for the title property and not for others (as mentioned in the first post,, that snippet is working fine).

Not sure where I am missing things.

Avatar

Level 10

currentPage.title is retrieved by objects at page level.

If you are not able to read properties saved from dialog using above suggested method.....then please see error.log as something is going wrong in your component.

If property exist it can be easily retrieved.

Avatar

Level 9

Hi Edubey,

Just an update,

If I try with data-sly-test="${currentPage.properties.customproperty}" in the above snippet. I am able to retrieve the custom property value at jcr:content level.

But the other doubt I had was :

#3] How do I retrieve dialog properties in the page, as the one mentioned in this post is not working.

Avatar

Level 10

Same way, example

<h1>${properties.data}</h1>

Let me know if I misunderstood your question...

Avatar

Level 10

Did you look at the article i posted (the 1st one) - it shows you how to retrieve the field values located in this Touch UI dialog using Sightly: 

Avatar

Level 9

Hi Scott,

Thank you for your reply.

Yes, I had a look at the article. There we are retrieving properties via the java code and then invoking that java code in the sightly file. With that approach it is working fine. But they want us to retrieve the property values only by making use of sightly and no Java.

@Edubey :

Not sure why "${currentPage.properties.customproperty}" is not working for properties at dialog level.

Not sure what am I missing here.

 Also, there are no errors getting logged.

Avatar

Correct answer by
Level 10

Why are you trying.. "${currentPage.properties.customproperty}"

You should use "${properties.customproperty}"

Avatar

Level 10

OK  - we will make a second article (similiar use case) that shows use without Java - that is - getting the values without using Java and just Sightly. 

Avatar

Level 9

Hi Scott/Edubey.

Thanks a lot for your reply.

My bad,  "${properties.customproperty}" worked perfectly fine as mentioned by you. Somehow had missed out something while trying out initially.

Avatar

Level 9

Hi Scott/Edubey.

Thanks a lot for your reply.

My bad,  "${properties.customproperty}" worked perfectly fine as mentioned by you. Somehow had missed out something while trying out initially.