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

How do I create the experience fragment variation programmatically

Avatar

Level 1

Hello everyone, can anyone help me understand with how we iterate through the master variation of experience fragment and how to create the variation using that programmatically considering that I am having the path of the fragment.

 

Thank you.

Topics

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
3 Replies

Avatar

Level 1

Hai @arunpatidar 

 

I am getting this error though I have create the service "test"

 

org.apache.sling.api.resource.LoginException: Cannot derive user name for bundle aem-ai-contentwizard.core [610] and sub service test
        at org.apache.sling.resourceresolver.impl.ResourceResolverFactoryImpl.getServiceResourceResolver(ResourceResolverFactoryImpl.java:79) [org.apache.sling.resourceresolver:1.11.0]

 

This is the service I have created

Shaikha_0-1701944794167.png

 

            ResourceResolver resourceResolver;
            paramMap.put(ResourceResolverFactory.SUBSERVICE, "test");
            resourceResolver = resourceFactory.getServiceResourceResolver(paramMap);
            session = resourceResolver.adaptTo(Session.class);
            PageManager pm = request.getResourceResolver().adaptTo(PageManager.class);

 

Avatar

Correct answer by
Community Advisor