Skip to main content
JakeCham
Level 6
Jan 21, 2021 1:27 PM UTC
Solved

Introducing a sly logic as a parent sly will harm existing data in AEM ?

<sly data-sly-test="logic"> //Newly added logic

    <sly data-sly-test="logic"> //existing logc

    </sly>

</sly>

Here I have wrapped the existing logic by a new logic and all of my existing content related to that inside sly logic got lost.

Any inputs highly appreciate.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
arunpatidar
arunpatidarAccepted solution
Community Advisor
Jan 21, 2021 7:05 PM UTC

If your first condition is rely on some new properties then yes the condition will always be a false and you will not see any content. If this is a case then add complex condition 
e.g. <sly data-sly-test="{properties.newProp && logic}">

Arun Patidar

7 replies

Anudeep_Garnepudi
Community Advisor
Community Advisor
Jan 21, 2021 1:37 PM UTC

@jakecham 

I don't think you need inner test condition because you are already checking on top. Try removing the inner/old/existing test condition.

Hope that works.

-AG

Translate
AG
JakeCham
JakeChamAuthor
Level 6
Jan 21, 2021 1:42 PM UTC
I have implemented this way long time ago.so content are on the clients sitte now.then new requirement came and I want to wrap the existing logic by new sly logic. Problem is content will be lost.
Translate
Suraj_Kamdi
Community Advisor
Community Advisor
Jan 21, 2021 4:02 PM UTC

@jakecham Please provide some sample code snippet just to know what you are actually doing?

Translate
Suraj Kamdi
BrianKasingli
Adobe Champion and Community Advisor
Adobe Champion and Community Advisor
Jan 21, 2021 4:59 PM UTC

Try to add variables to your sightly elements.

 

<sly data-sly-test.modelA="com.mysite.core.slingmodels.button"> //Newly added logic <sly data-sly-test.modelB="com.mysite.core.slingmodels.buttonflat"> //existing logc </sly> </sly>

 

Translate
Level 3
Jan 21, 2021 6:03 PM UTC

Hi,

 

Case A -

Looks like new logic " data-sly-test='logic' " returning false which don't allow to execute the inner portion

Case B -

If you have 2 different test conditions then define with variables like data-sly-test.new="logic" and data-sly-test.old="logic"

 

Thanks,

Kiran Parab

Translate
arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
Jan 21, 2021 7:05 PM UTC

If your first condition is rely on some new properties then yes the condition will always be a false and you will not see any content. If this is a case then add complex condition 
e.g. <sly data-sly-test="{properties.newProp && logic}">

Translate
Arun Patidar