Ask Me ?


Hi Readers,

Here you may comment all the questions/ doubts which you encountered during your journey for AEM. I will try my best to help you out and might connect with you to solve them too.

Also you may post interesting questions which you went through during your respective interviews , and I will try to answer them and thereby increase the Question Bank for masses.

So go ahead and post the questions !!

Thanks a lot .

Hashim

356 thoughts on “Ask Me ?

  1. Hi Hashim,

    I have a requirement to make few components inside templates flexible for author to modify/delete.
    I added those component nodes inside “par” node in “jcr:content” of template so as to allow author to delete or change on Page .
    Is it a best practice to have most of the templates with the similar approach instead of adding everything in page components.What can be the flaws of this approach.
    Can you please guide me on this.

    Thanks!!
    Farah

    Like

    • Hi,

      The aim while in designing phase should be to have a balance between Complexity/Ease of a Page creation and the least number of templates possible. You should add only those components in the template which should not be removed at all or are inherited.

      If the authors are capable enough to use min number of templates and can design the page using different components on their own, then let it be.

      No of templates should be as min as possible.

      Flaw can come up if they have to drag and drop 5-6 components each time when a new page is created. This redundant activity might lead to delay in authoring and hence productivity.

      Also if different author , drag and drop different components for the same kind of page, there can be a risk of error . Such risk will not be there if there are predefined templates.

      I hope I answered your query.

      Thanks
      Hashim

      Like

  2. Hi Hashim:

    I am facing a rather tricky problem in one of my AEM 6.1 applications.

    The problem is:
    When I ‘Open Properties’ of a page and go to ‘Thumbnail’ tab and do ‘Generate Preview’, it generates just a blank (1 pixel) image and not the snapshot of the entire page. Since this is an OTB functionality, this should simply work by default but unfortunately I am not sure what in our code or implementation is stopping this from working. This broken behavior is consistent across all the pages in my application.

    Interestingly, this feature is working perfectly fine on the demo (geometrixx) sites, on all the pages.
    In a way this is a good news, as in, whatever our code or our implementation has messed up has not really affected the core code( under libs/foundation).

    I have spent significant time on this looking into various clues and hints only to hit a wall every time.
    Any help/guidance/suggestion/pointer will be highly appreciated!

    And many thanks in advance for helping and sharing your knowledge and expertise in such a selfless manner.

    Thanks,
    -Firoz Khan

    Like

    • Hi Firoz,

      What I can infer from the description is that you are not viewing Thumbnail for a page in Touch UI. Two approaches can be used to identify the root cause. Compare with the Geometrixx application – what part of code is responsible for that thumbnail . Now check that code if you have overwritten in your application project code. Take backup and try to make the code same, if that helps.

      Secondly try to find from where the image is getting picked up. May be some property you are not adding for your page which might be present on the Geometrixx page. Try to make the properties same one by one for both pages and check. (This might help if you have not overridden some /libs/foundation code).

      Finally you’re welcome. Sometimes to gain knowledge you have to spread knowledge.
      Regards
      Hashim

      Like

  3. Thanks for your prompt response Hashim. I would have definitely made some progress (instead of being stuck) if I was able to determine what part of code is generating that thumbnail preview or what exact code we overlaid, which is causing this.

    Whats worth noting here are 2 things:
    – If choose a static image (Upload Image button) then its not a problem
    – so only generating the page snapshot dynamically is not working

    Again, will appreciate any help.

    Thanks,
    -Firoz

    Like

  4. Hi Hashim,

    Thanks for your earlier guidance.

    I have a requirement to create generic slider component in Sightly AEM6.2 .I need to drag & drop the same component on the same page multiple times .But whenever i am inserting component more than once,On refreshing the page it goes away.Is there any way I can add a class with unique Id,I appended {resource.name} in the class but still no luck.
    Can you guide me on this.

    Thanks once again.

    Farah

    Like

  5. HI Hashim,

    I have come across a requirement like component need to be locked if anyone is working on that component. i.e it should get locked if any one working on it so that nobody wil work on the component simultaneously . Is this possible to achieve?
    Regards,
    TONY

    Like

  6. HI Hashim,
    I have come across a requirement like component need to be locked if anyone is working on that component. i.e it should get locked if any one working on it so that nobody wil work on the component simultaneously . Is this possible to achieve?
    Regards,

    Like

  7. Hi Hashim,

    Thanks for the help for previous queries.

    We have requirement to create a target profile to target certain users. The content for the user is decided by the attributes preset with user when he logged in. The user details are not stores in AEM. We are creating segmentation for creating those rules as the number of attributes is quite large and thus the combination for those rules. We thought of ” adding custom meta data for assets and display all segments and writing custom logic for it’s computation”. We aren’t able to figure out if there’s any API which can be used to trigger the rules .

    Also please suggest if there’s any other approach you have came across..

    Like

    • Hi Hashim,

      In addition to above, the content being targeted here is DAM Assets which can be anything like PDF’s etc and targeting is due to restrict the access based on certain criteria being .managed by the user attributes.

      Like

        • Hi Hashim,

          Client is only using AEM and no other products. The user profiles won’t be available in AEM due to high customer base and the personalisation needs to be achieved using combination of those attributes values like: say ((some_attribute_1==1) OR (some_attribute_2=”some string”)) && ((some_attribute_1==5) AND (some_attribute_4=”some string”)). The rules will be similar sort of combination of attributes and content needs to be displayed on the basis whether attributes attached with current logged in user matches the criteria.

          Like

  8. Hi Hashim,

    Thanks for your guidance earlier.

    I am working on AEM 6.2.I have a requirement to add a theme property in user profiles.

    I managed to add a property in user profile but I am not able to update the property progammatically & fetch its value.

    I tried using AccountManagerFactory for adding property in profileMap with updated value but AccountManager seems to be deprecated in AEM6.2.

    Is there any way I can fetch User property at javascript level in Sightly.

    Can you guide me on this.

    Thanks.
    Farah

    Like

  9. Hi Hashim,

    We have a requirement where DAM assets needs to be displayed on UI. Business won’t be maintaining any specific heirarchy in DAM and there are many junk files which need not be shown on UI so we cannot just iterate over /content/dam//folder-heirarchy and disaply the assets on UI. They need a provision to create a folder structure on UI with any name as per user relevance and want to add files beneath linking them with DAM asset. There can be any number of folder hierarchy before files are added. Can you suggest some solution to achieve the objective?

    Like

    • I couldn’t understand the full requirement of this . What are they trying to achieve ?
      Are they uploading assets too ? On the UI page , store links/references of the assets only , while the actual asset is stored in a well defined hierarchy in DAM.

      The folder structure on UI page should be different from the one in DAM.Let them select assets from DAM and store thier references on the UI page.

      If they are asking to upload it from the UI page too, then also add the asset to DAM programmatically while just storing its link on the UI page.

      Does that makes sense ? Please explain the problem more clearly, if otherwise.

      Like

  10. Hi Hashim,

    I have one doubt.
    I have been trying to create one excel sheet and save it into DAM.I am able to create excel in DAM, but no data is there in that excel. I am using following codes to create it.

    String filename = “updatedMetadata.xls”;
    FileOutputStream fos = new FileOutputStream(filename);
    WritableWorkbook workbook = Workbook.createWorkbook(new File(filename));
    WritableSheet writableSheet = workbook.createSheet(“Updated Metadata”, 0);
    Label label = null;
    label = new Label(0, 0, “Header1”);
    writableSheet.addCell(label);
    label = new Label(0, 1, “Header2”);
    writableSheet.addCell(label);
    label = new Label(0, 2, “Header3”);
    writableSheet.addCell(label);
    label = new Label(0, 3, “Header4”);
    writableSheet.addCell(label);
    label = new Label(0, 4, “Header5”);
    writableSheet.addCell(label);
    label = new Label(0, 5, “Header6”);
    writableSheet.addCell(label);
    label = new Label(0, 6, “Header7”);
    writableSheet.addCell(label);
    label = new Label(0, 7, “Header8”);
    writableSheet.addCell(label);
    label = new Label(1, 0, “col val”);
    writableSheet.addCell(label);
    label = new Label(1, 1, “col val”);
    writableSheet.addCell(label);
    label = new Label(1, 2, “col val”);
    writableSheet.addCell(label);
    label = new Label(1, 3, “col val”);
    writableSheet.addCell(label);
    label = new Label(1, 4, “col val”);
    writableSheet.addCell(label);
    label = new Label(1, 5, “col val”);
    writableSheet.addCell(label);
    label = new Label(1, 6, “col val”);
    writableSheet.addCell(label);
    label = new Label(1, 7, “col val”);
    writableSheet.addCell(label);
    label = new Label(2, 0, “col val”);
    writableSheet.addCell(label);
    label = new Label(2, 1, “col val”);
    writableSheet.addCell(label);
    label = new Label(2, 2, “col val”);
    writableSheet.addCell(label);
    label = new Label(2, 3, “col val”);
    writableSheet.addCell(label);
    label = new Label(2, 4, “col val”);
    writableSheet.addCell(label);
    label = new Label(2, 5, “col val”);
    writableSheet.addCell(label);
    label = new Label(2, 6, “col val”);
    writableSheet.addCell(label);
    label = new Label(2, 7, “col val”);
    writableSheet.addCell(label);
    workbook.write();
    workbook.close();
    ResourceResolver resourceResolver = request.getResourceResolver();
    AssetManager manager = resourceResolver.adaptTo(AssetManager.class);
    InputStream is = this.getClass().getResourceAsStream(“/content/dam/company/fileFolder/” + filename);
    Asset asset = manager.createAsset(“/content/dam/company/fileFolder/” + filename, is, “application/vnd.ms-excel”, true);

    File is creating in this Path “/content/dam/company/fileFolder/”
    File name is “updatedMetadata.xls”

    Thanks in advance
    Mahesh Narayanan

    Like

  11. Hi Hashim,

    I have moved an asset(filename.xml) from /content/project folder to /content/project/archive folder using assetManager.moveAsset() function, now my requirement is to rename the asset in the archive folder programmatically. What is the right api to rename a dam asset?

    Like

  12. Hi Hashimkhan,

    May I ask you?

    The requirment is to activate the page using custom workflow step.

    Understand that the out of the box (Activate Page/Asset) can only activate the page but not for new images and component. Meaning we need to activate the whole jcr:content (e.g. new image, new component) for this page.

    Thank you. Appreciate it.

    Best regards,
    Brian

    Like

    • Hi ,
      When you will activate a page, the jcr:content will be activated too along with it. However the component is not content and needs to be deployed on Publishers and not activated.
      You can also activate the DAM content independently or you can try to find the DAM assets and activate them individually in the code using the Process step.

      Check how it works when you activate a page in siteadmin which has an image. It shoots a call to /libs/wcm/core/content/reference.json which gives an array of assets .

      Regards
      Hashim

      Like

  13. Hi Hashim,

    I was able to clear many interviews with the content that you have shared online.
    I would like to thank you for sharing such useful content.

    I am planning to give the Adobe Certified Expert Exam for AEM 6 Developer.
    I have about 3 years of experience with CQ5.5.

    Should I go for the Lead Developer Exam or Developer Exam?

    I was referring the links below:
    https://training.adobe.com/certification/exams/aem_6_0_developer.html
    https://training.adobe.com/certification/exams/aem_6_lead_developer.html

    Your inputs are very valuable to me. Awaiting your response.

    Thanks and Regards,
    Oliver Kaunds

    Like

  14. Hi,

    I am currently working with AEM forms, I have also created custom constraints for the form and everything works as expected. But in one of the constraints logic will change based on the data entered in another field. How to do that?

    ex: I have a constraint for ZIPCODE, the logic should changed based on the country field which is enetered. How to do it using aem form validation (clientvalidation.jsp & servervalidation.jsp)

    Like

  15. HI Hashim,

    I have a use case that a workflow(process step) on the author will invoke publish instance JCR. It will read properties of given path in publish instance.

    I am trying to connect Publish instance from author instance using below code snippet . Generally, this code is used for connecting JCR from stand alone java class.

    Repository repository; repository = JcrUtils.getRepository(repositoryPath);
    When ran my workflow got below error .

    Not able to access Repository ++++Unable to access a repository with the following settings: org.apache.jackrabbit.repository.uri: http://10.55.91.171:9999/crx/server The following RepositoryFactory classes were consulted: Perhaps the repository you are trying to access is not available at the moment.
    Below full code snippet

    @Component( label = “CONNECT PUBLISh INSTANCE”, description = “Sample – CONNECT PUBLISh INSTANCE Implementation” ) @Service public class ConnectPublishInstance implements WorkflowProcess{ String contentPath = “/content/gvol/en/alert/alert1/jcr:content”; String ipAddress = “10.55.91.171”; String portNumber = “9999”; String userID = “admin”; String pwd = “admin”;

    public void execute(WorkItem arg0, WorkflowSession arg1, MetaDataMap arg2) throws WorkflowException {

    //calling CRX getCRX();
    } public void getCRX(){ Session session; try { session = getSession(ipAddress, portNumber, userID, pwd); Node rootNode =
    session.getNode(contentPath); if(rootNode.hasProperty(“ea_title”)){ System.out.println(“TItle”+rootNode.getProperty(“ea_title”).getString()); } } catch (RepositoryException e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println(“Not able to access Repository ++++”+e.getMessage()); }

    } /**
    *
    * @param ipAddress
    * @param portNumber
    * @param userID
    * @param pwd
    * @return
    * @throws RepositoryException
    */
    public static Session getSession(String ipAddress, String portNumber,
    String userID, String pwd) throws RepositoryException {
    String repositoryPath = MessageFormat.format(
    “http://{0}:{1}/crx/server”, ipAddress, portNumber);
    Session session = null;
    Repository repository;

    repository = JcrUtils.getRepository(repositoryPath);
    session = repository.login(new SimpleCredentials(userID, pwd
    .toCharArray()));

    return session;
    }
    Is my approach right. If not please suggest how to access Publish instance JCR from a workflow process step in Author instance.

    I have below dependency in my root pom.xml and bundel.xml

    org.apache.jackrabbit
    jackrabbit-jcr2dav
    2.2.4

    org.apache.jackrabbit
    jackrabbit-jcr-commons
    2.2.4

    Like

  16. Hi Hashim
    I have a requirement such that when i create a new page like en/sample1.html it will have to automatically create under ex fr/sample1.html. how to achieve this? i think sample1 is node so can we copy that node under fr. if it is correct approach how to copy node under another node. if it is wrong could you please tell me how to reach this one.

    Thanks in advance

    Like

  17. Hi . I just started working in AEM. I need to add a feature to download option in DAM. It must convert .jpg to .png. Code is working fine. Now i need to override the default download option in DAM .

    So i need to know where the codes for the DAM tool bar will be there in crxde,

    So that i can understand how the download works and implement my code.

    Reply ASAP. Its kinda urgent
    TIA

    Like

  18. Hi,

    When I try to open “http://localhost:4502/content/geometrixx-outdoors/en” I get 403 error, But when opened with ‘.html’ extension page opens. Can I know whats the concept behind this?

    Thanks in advance!!

    Like

  19. Hi Hashim,

    I usually followed your blog. Thanks for sharing all AEM thoughts here.

    At present I’m working on AEM 6.2 version. We had a requirement to display all folders first then followed by all of the files/assets and also all folders and files/assets should be arranged in alphabetical order in following path http://localhost:4502/assets.html/content/dam. Usually all folders and assets will follow insertion order. To overcome this requirement I overlay this /libs/dam/gui/coral/components/commons/ui/shell/datasources/assetsdatasource/assetsdatasource.jsp
    and modified below code in query builder.
    res.put(“path”, contentRsc.getPath());
    res.put(“path.flat”, “true”);
    res.put(“p.limit”, Integer.toString(rows));
    res.put(“p.offset”, Integer.toString(offset));
    res.put(“orderby”,”type”);
    res.put(“orderby.sort”,”DESC”);

    I can able to display all folders first then followed by all of the files/assets. But it is not sorted alphabetically.
    If we use in place of res.put(“orderby”,”type”); as res.put(“orderby”,”path”); we can get all folders and files are in alphabetical order with mix up(like all folders and files are in mix, there is no separation from folders and files).

    I have follwed this way also
    res.put(“orderby”, “type”);
    res.put(“group.p.or”, “true”);
    res.put(“group.1_type”, “sling:Folder”);
    res.put(“group.1_type”, “sling:OrderedFolder”);
    res.put(“group.2_type”, “dam:Asset”);

    No luck. Can you please help on this?

    Like

  20. I am configuring a push notification service using Amazon SNS and i am not using an aem mobile -app. I need to send messages to the SNS through AEM. My question is how do i send messages to the Amazon SNS through AEm?? I am in need of urgent help.

    Like

  21. Hi Hashim,

    We are using SAML authentication for login to AEM. It is working fine in author as users are present in AEM. But for publish instance, users will not be kept in AEM and thus unable to use existing SAML Handler. Their documentation also states that it is the limitation of OOTB handler.

    https://helpx.adobe.com/experience-manager/kb/saml-demo.html

    Limitations
    User Must Exist in AEM
    Users logging in via the handler must exist, or if missing must be created in, AEM (“Autocreate CRX Users” must be checked). This is because the Sling authentication framework, which the SamlAuthenticationHandler is a part of, extracts user credentials from the SAMLResponse and logs into the JCR repository using those credentials.

    Any suggestion how we can use SAML for authentication for publish.

    Like

  22. I need one help. Below is my query:
    I have an application and its heap size is increasing drastically i a very short span. I analysed the heap dump and received below error:

    [1479659159628] GET /content/dam/xyz.480.370.jpg HTTP/1.1 120 240,103,032 sun.misc.Launcher$AppClassLoader @ 0x4c001d3a8 false
    java.lang.Thread @ 0x4caff89f8

    Everything is getting stored in byte[].

    Can you please tell me why such heap memory is getting created?
    Is it mandatory to cache DAM images also?
    If i will cache DAM, will my issue get resolve?

    Like

    • Its always advisable to use a CDN and Dispatcher Module for caching of DAM images. I am not sure if thats the root cause of the heap dump, but you can definitely try that as a next step.

      Like

  23. Hi Hashim,

    Is there any way to trigger the MSM “Update References” Syncronization Action through a workflow, service or any other? No matter if is programmatically or just using the OOO tools.

    Like

    • Hi,
      I believe you must have configured the Rollout configuration for MSM with the Synchronization Action of Update References. OOTB there are few triggers available – on Rollout, On Modification , On Activation , On DeActivation. It depends how have you configured the Rollout configuration.
      If you need to do via code , either you can initiate an Activation/Deactivation event or modify a property on that node or use cURL to trigger a rollout.

      Like

  24. Hello, i looking at ways to keep the jcr:uuid property consistent across author and publish env to meet a requirement. When we publish the page it looks like this property is not being replicated but rather its getting auto-generated on the publish instance with a different value. Is there a easy way you could include this property as part of the replication, just like how it replicates the other properties on the page. Thanks in advance for your help

    Like

    • Hi,
      jcr:uuid property is created by OOTB core classes when a node is created in an instance- author and publish. So its possible there could be a mismatch. But you can always create a custom uuid property which you can make it same in Author and Publish. This property will contain same value on replication.

      Like

  25. Hi Hashim,

    I have requirement of creating a workflow in which user is able to set the future date to publish a page at that time. I have created this using a dialog participant step, to which i have mapped the dialog path of the datepicker. But i’m facing the issue here that the dialog appears in the next step that i have after dialog participant step. Please let me know if there’s any way to get the dialog in the same step as dialog participant step.
    Thanks in advance.

    Like

      • Hi Hashim,
        I am actually using a “OR Split” step where i’m providing the user with two options: Publish Now and Publish Later. Publish Later is the dialog participant step where i’m providing the path of the dialog to enter the future date and time. Then in the next step, i have the “Process” step i.e, “Publish Page” in which i’m calling my java class. But here the dialog appears in this process step.

        Like

        • Ideally the dialog shouldn’t occur at the next step. I wonder how are you deciding the OR split between Publish now and Publish later. You can do one thing, if the user chooses Publish Later , you can include a Date field there itself instead of an additional dialog step and Store that date property in the jcr:content of the page. You can use that date in your process step /Java class .

          Like

  26. Hi Hashim,

    We have a requirement where business wants user restriction for editing the components for the page. Say for eg: Page with 6 components is opened in Edit mode. So a certain user can edit only few components and “Edit” option for component is available only for those specific components and not for others. We are not sure whether this is feasible to control the access at component level.

    Kindly suggest if you have encountered anything similar earlier. Any suggestion/guidance would help here.

    Like

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s