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

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

Avatar

Level 7

<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.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

View solution in original post

7 Replies

Avatar

Community Advisor

@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

Avatar

Level 7
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.

Avatar

Community Advisor
I don't think will loose content. The latest HTL file will be executed across old and new pages. Try to check this way, create a page/component in local box with your old logic and then update the logic and refresh the page and see if there is any change.

Avatar

Community Advisor

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

Avatar

Community Advisor

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>

 

Avatar

Level 4

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

Avatar

Correct answer by
Community Advisor

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