Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Not able to unlock template layout container (both root and any custom templates) after publish via sling job.

Avatar

Level 2

samaraneni_0-1702350336797.png

I need to publish templates and template types along with other nodes. I achieve this with a sling job, however, unlock doesn't work on the template root and also on any custom templates created on top of the published template-types.

I notice that, if I pass replicationOptions.setSuppressStatusUpdate(true) it works. But this would not update properties like 'isActivated', 'cq:lastReplicated' and 'cq:lastReplicatedBy' which is a limitation for me.

 

Version: AEM 6.5.15

Please help me resolve this issue.

Topics

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

11 Replies

Avatar

Community Advisor

Hello @samaraneni 

 

We need not publish template-types, only templates are required.

All pages are rendered via templates.

 

Template-types are only a template to create new templates. You can skip publishing the same.

 

Please try and validate on publish that all features work fine without template-types


Aanchal Sikka

Avatar

Level 2

Thanks for the response.

I agree excluding 'template-types' from publishing would let me unlock, however I have this concern with not publishing 'template-types'

1) They won't exist in publish instance anymore but there is a reference to template-types as shown in this image

samaraneni_0-1702389221055.png

Are there any potential issues that could arise if these elements are not included? In the package approach, these elements are present in the published instance. I want to ensure that transitioning to the API approach won’t inadvertently cause any issues.

 

Avatar

Community Advisor

@samaraneni 

As per my understanding, it should be ok to skip template-types on publish.


Aanchal Sikka

Avatar

Level 2

Hi Aancha,

 

I have excluded 'template-types' from the publish logic, now the templates and rest of the nodes are published. Although the custom templates built using template-types are unlocking, the 'template-root' unlock is still not working. Please share your thoughts

I see POST with 200 for root call. (Note: when the unlock is successful I see POST with 201 response code)

samaraneni_0-1702656509677.png

 

samaraneni_1-1702656605588.png

 

I suspect that when the replication properties are set during replication this is happening. Please share your thoughts

Avatar

Community Advisor

@samaraneni 

 

I have tried on WKND site. 

I am able to unlock root with replication params as well

 

I would suggest, not to unlock root. That is the basic structure of your template. You would not want anyone other than template editors playing with it.

In my opinion, it should stay locked.


Aanchal Sikka

Avatar

Level 2

Thanks for validating. I want to make sure the api approach is behaving similar to package where the admin can edit the 'template-root'.

On further debugging the issue I noticed that an extra flag `"structureLocked":true` is being passed with the 'editable' parameter to the unlockStructureComponent method in case of nodes with published templates whereas for nodes without published templates this property is not there.

samaraneni_0-1702778426721.png

 

 

I'm not setting this during publish. Do you know why and how this property is being set? Can I override it programmatically or what's the better way to handle this?

 

 

Avatar

Community Advisor

@samaraneni 

 

I am not getting "structureLocked" param in following request http://localhost:4502/bin/wcm/template/sync.html/conf/wknd/settings/wcm/templates/landing-page-templ...

 

May be install WKND and compare templates. Basic structure until root might be same.You might be able to find some difference


Aanchal Sikka

Avatar

Level 2

Hi Aanchal,

I am able to reproduce the issue with WKND. Here are the steps

1. Replicate the root node using 'replicate' option in crxde as show in this screenshot

samaraneni_0-1702782240863.png

2. Now navigate to template editor page and try to unlock, you get 200 response code for POST instead of 201 created and unlock won't happen

samaraneni_1-1702782335209.png

Please let me know your thoughts.

Avatar

Community Advisor

@samaraneni 

 

Please do not replicate nodes individually. Publish only the template.

 

I have published the template and root. Still able to unlock

aanchalsikka_0-1702783835334.png

 

One difference is I am using AEM Cloud SDK.

 


Aanchal Sikka

Avatar

Level 2

Now I have tried with the parent nodes published at these levels

/conf/wknd/settings/wcm

/conf/wknd/settings/wcm/templates

/conf/wknd/settings/wcm/templates/adventure-page-template/structure

/conf/wknd/settings/wcm/templates/adventure-page-template/structure/jcr:content

/conf/wknd/settings/wcm/templates/adventure-page-template/structure/jcr:content/root

Still I see the same issue with unlocking http://localhost:4502/bin/wcm/template/sync.html/conf/wknd/settings/wcm/templates/adventure-page-tem...

Could you please try reproducing the issue on AEM 6.5.15. Thanks

Avatar

Administrator

@samaraneni Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni