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

I have date field and tag field in dialog box. I have to fill tag field based on the date in date field and subsidary of the page.

Avatar

Level 3

I  have startDate as date field and year as tag Field. I have to fill year tagfield based on year of startDate and subsidary they are in.

 

Here you can see i am in cytech subsidary and startdate has 2012 . tag here is appled cytech:year/2012.

 

Now i want to do for all subsidaries when i chage  or add date, the year tag should be automatically updated based on year in startDate and subsidary it is in. i have done using path based servlet by  sending request and dynamically loaded using javascript. i want another approaches as many as possible. i am new to AEM and CMS. remember i am not using HTL as they are in page properties. feel free to ask for further information.

 

Screenshot 2024-09-02 181309.pngScreenshot 2024-09-02 181355.pngScreenshot 2024-09-02 181529.pngScreenshot 2024-09-02 181543.png

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@AliSyed1 

You can create an event listener which can update the year property, whenever start date property gets updated

https://medium.com/@toimrank/aem-handler-and-listener-12b6c8b5a3d3

View solution in original post

5 Replies

Avatar

Correct answer by
Community Advisor

@AliSyed1 

You can create an event listener which can update the year property, whenever start date property gets updated

https://medium.com/@toimrank/aem-handler-and-listener-12b6c8b5a3d3

Avatar

Level 3

thanks . i will take a look into it and inform you if i have further doubts.

Avatar

Community Advisor

Hi @AliSyed1 

If you can already derive the tag-field (Year) value from the date-field (Start Date), there’s no need to add an additional authorable tag field (Year) in the page properties.

You can simply generate the Year value at the backend (using Sling Models, Services, etc.) wherever it's needed. If there’s specific context we're missing, please share. Otherwise, you can use a JavaScript event listener to achieve this, as AEM OSGi/Sling Resource listeners won’t help since the values are updated only after the page properties are submitted.



Arun Patidar

Avatar

Level 3

Thanks bro. My requirement is to change property in crx based on the subsidiaries name. I have done it using @AMANATH_ULLAH suggestion.