Friday, 17 February 2017

Spring Editons of Ask the AEM Community Experts

Hello AEM Community. I wanted to let you know that we have lined up some very awesome sessions of Ask the AEM Community Experts for you:


  • In March we will focus on AEM and Analytics and how to work with these two products in AEM 6.2.
  • In April we will focus on how to work with the Coral API when doing AEM development. 

This is your chance to attend and ask the community experts questions related to these subjects and see the use cases in action.

Sign up for both of these sessions will be posted in early March.



Adobe Digital Marketing Community

Join the Adobe Digital Marketing Community. Start by clicking this banner



I (Scott Macdonald) am a Senior Digital Marketing Community Manager at Adobe Systems with over 18 years in the high tech industry. I am also a programmer with knowledge in Java, JavaScript, C#,C++, HTML, XML and ActionScript. If  you would like to see more CQ or other Adobe Digital Marketing end to end articles like this, then leave a comment and let me know what content you would like to see.


TwitterFollow the Digital Marketing Customer Care team on Twitter @AdobeMktgCare.

TwitterFollow me on Twitter @smac2020  



Wednesday, 15 February 2017

Creating a custom Experience Manager sling:resourceType for Touch UI

You can create a custom sling resource type that can be used in an Adobe Experience Manager (AEM) Touch UI component by using a JQuery plug-in. That is, if you want to define a field in a Touch UI component dialog that is not available with the available Granite API, you can define your own custom type. This is similiar to how you can define a custom xtype when working in the Classic UI. For information, see Creating your first Adobe Experience Manager custom xtype.

As an AEM developer working in the Touch UI, it is important to understand how to create a custom sling resource type to be able to define custom fields.  In the AEM community, there has been requests on how to develop a full color spectrum field for a Touch UI component dialog, as shown in this illustration.


To successfully get this color picker in an AEM Touch UI dialog, specify a path that references the JQuery plugin as a value of the sling:resourceType property in CRXDE Lite, as shown here.  




Adobe Digital Marketing Community

Join the Adobe Digital Marketing Community. Start by clicking this banner



I (Scott Macdonald) am a Senior Digital Marketing Community Manager at Adobe Systems with over 18 years in the high tech industry. I am also a programmer with knowledge in Java, JavaScript, C#,C++, HTML, XML and ActionScript. If  you would like to see more CQ or other Adobe Digital Marketing end to end articles like this, then leave a comment and let me know what content you would like to see.


TwitterFollow the Digital Marketing Customer Care team on Twitter @AdobeMktgCare.

TwitterFollow me on Twitter @smac2020  



Tuesday, 7 February 2017

Creating an AEM HTL component that queries the JCR

You can create an Adobe Experience Manager (AEM) HTL (used to be known as Sightly) component that queries data located in the AEM Java Content Repository (JCR). To query data, you use an HTL Java class that extends the WCMUsePojo API and the javax.jcr.query.Query instance that belongs to the JCR Query API. This API supports both searching and querying operations. For example, assume that your AEM application tracks your organization’s customers. You can develop an AEM HTL component that is able to query the JCR to obtain a customer result set in which a digital marketer is interested.



Assume that you have customer data in the AEM JCR. 



Using an HTL component that extends WCMUsePojo, you can retrieve the JCR data and display it.



This development walks you through how to create an AEM HTL component that queries a result set from the JCR. To read this development article, click https://helpx.adobe.com/experience-manager/using/htl_jcr.html

Adobe Digital Marketing Community

Join the Adobe Digital Marketing Community. Start by clicking this banner



I (Scott Macdonald) am a Senior Digital Marketing Community Manager at Adobe Systems with over 18 years in the high tech industry. I am also a programmer with knowledge in Java, JavaScript, C#,C++, HTML, XML and ActionScript. If  you would like to see more CQ or other Adobe Digital Marketing end to end articles like this, then leave a comment and let me know what content you would like to see.


TwitterFollow the Digital Marketing Customer Care team on Twitter @AdobeMktgCare.

TwitterFollow me on Twitter @smac2020  


Saturday, 4 February 2017

Adobe AEM FAQs and other Tips

This post captures FAQs, and other tips for AEM that AEM Developers will find useful. We will update this list on an on-going basis.

Can I programmatically work with Coral UI object such as checkboxes?

Yes you can. It involves creating a JS script in an AEM Clientlib and then coding. See the reference documentation here:


Given this setup in CRXDE Lite: 



You can get a reference to this checkbox object in a clientlibs folder. The name of the clientlibs folder for Touch UI dialogs is cq.authoring.dialog ( this is talked about here.  http://scottsdigitalcommunity.blogspot.ca/2015/05/using-event-handlers-in-adobe.html).

Code: 

(function ($, $document) {
    "use strict";

   

    $document.on("dialog-ready", function() {


        $('#kitten').attr('checked', true);     

        });


})(jQuery, jQuery(document));

The result is the checkbox is checked via code: 




Note - we are planning on conducting a full session of AEM Ask the Community Experts on AEM Developing with the Coral API April 2017. 

Can i use OAuth in AEM? 

Need to search for special characters when searching JCR via JCR SQL2

Read this topic -- https://wiki.apache.org/jackrabbit/EncodingAndEscaping. YOU  need to escape illegal JCR characters.

How can i work with custom JARs that are not in the Maven repository

You can place the JAR in your local Maven Repository and then reference it in your POM file. For example, to resolve myCustomJAR_1.0.0.jar within an AEM service, the myCustomJAR_1.0.0.jar file must be located in the Maven repository. You can upload the myCustomJAR_1.0.0.jar to Maven by using this Maven command: 

mvn install:install-file -Dfile=C:/plugins/myCustomJAR_1.0.0.jar -DgroupId=com.foo.reports -DartifactId=jrurbersrt1.0 -Dversion=1.0 -Dpackaging=jar -DgeneratePom=true

Notice that you must specify the location of the myCustomJAR file in the -Dfile argument. Also notice that you specify the Dgroup and DartifactID values. Once you upload the JAR to Maven using this command, you can reference this JAR file using this Dependency.

<groupId>com.foo.reports</groupId>
<artifactId>jrurbersrt1.0</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>C:\Users\scottm\.m2\repository\com\foo\reports\jrurbersrt1.0\1.0\myCustomJAR_1.0.0.jar</systemPath>
</dependency>

Notice that scope element is system and systemPath references the location of the JAR file in the repository. (This dependency is used later in this article to build the AEM service) 

How can i work with 3rd party JARs when i create an OSGi bundle

When working with OSGi bundles that use 3rd party JARs (that are located in the Maven Repository), you can embed the 3rd party JAR (for example, Simple JSON JAR) into a separate bundle and deploy to AEM. See this community article/video for details.


http://scottsdigitalcommunity.blogspot.ca/2013/06/posting-form-data-to-adobe-cq-using.html

Can I use @Reference in an HTL Class that extends WCMUsePojo

You cannot use the @Reference annotation from a HTL class that extends WCMUsePojo. This can be used from a Java class that uses @Service to reference another service known as dependency injection. To learn about Dependency Injection in AEM, see this article: 


Now to learn how to get a referenece to another AEM service from a class that extends WCMUsePojo, see this article: 

Enable CORS Access-Control-Allow-Origin in AEM

If you use the default AEM JQuery, it has a token that lets you perform AJAX operations to AEM. 

AEM is experiencing slow page loading

 Capturing comments in a default email template used by an AEM 6.2 workflow

You can write a custom workflow step and inject values you want to populate into a email template with Java logic. For example: 

//Populate the MAP with the values 
 myMap.put("topic.subject",TopicSubject); 
 myMap.put("time",timeStamp); 
 myMap.put("host.prefix",hostPrefix); 
 myMap.put("forum.url",forumUrl); 
                     
 //Declare a MessageGateway service
 MessageGateway<HtmlEmail> messageGateway; 
                        
 //Specify the EMail template 
 String template ="/etc/notification/email/html/com.day.cq.collab.forum/en.txt";
              
 Resource templateRsrc = request.getResourceResolver().getResource(template);
               
 MailTemplate mailTemplate = MailTemplate.create(templateRsrc.getPath(), templateRsrc.getResourceResolver().adaptTo(Session.class));
                      
 HtmlEmail email = mailTemplate.getEmail(StrLookup.mapLookup(myMap), HtmlEmail.class);

A solution without coding is to use the variable ${item.data.comment} in the default en.txt. To see other variables that can be used, see https://docs.adobe.com/docs/en/aem/6-2/administer/operations/notification.html#Configuring the Workflow Email Notification Service.

Wednesday, 1 February 2017

Sign up to the AEM Dev Community Newsletter

We are starting a new program in the AEM Community. We are going to release a monthly AEM Community Newsletter. This will keep those whom subscribe up to date with everything going on in the AEM community - such as:

  • upcoming Ask the AEM Community Sessions
  • new content such as articles, Github examples, videos, etc
  • programs like Immerse and various AEM conferences
  • other interesting topics such as various announcements to contests, etc

We will release the first edition in March 2017. All you have to do is fill in this small online form:



Note: If you want to learn how to build your own HTL Newsletter component to use in your own projects - see Creating an Adobe Experience Manager Newsletter HTL component.

Adobe Digital Marketing Community

Join the Adobe Digital Marketing Community. Start by clicking this banner



I (Scott Macdonald) am a Senior Digital Marketing Community Manager at Adobe Systems with over 18 years in the high tech industry. I am also a programmer with knowledge in Java, JavaScript, C#,C++, HTML, XML and ActionScript. If  you would like to see more CQ or other Adobe Digital Marketing end to end articles like this, then leave a comment and let me know what content you would like to see.


TwitterFollow the Digital Marketing Customer Care team on Twitter @AdobeMktgCare.

TwitterFollow me on Twitter @smac2020  

Feb ATCE - Building responsive layouts using Bootstrap and Angular JS

Join AEM Community Super User Lokesh BS, community member of the year 2015/2016 - for a discussion on "Building responsive layouts using Bootstrap and Angular JS in Experience Manager". By joining this session, you will learn AEM development techniques that you can apply to your Experience Manager projects. Lokesh will provide demos and be on hand to answer your questions. As an Adobe Experience Manager developer, this is a session that you do not want to miss.



To sign up, click:

https://communities.adobe.com/content/usergenerated/content/cush/en/communities/aem_technologistsdevelopersarchitects/events/_jcr_content/par/calendar/ask_the_aem_communit_7.form.html/content/cush/en/communities/aem_technologistsdevelopersarchitects/events/upcoming-event-detail


Adobe Digital Marketing Community

Join the Adobe Digital Marketing Community. Start by clicking this banner



I (Scott Macdonald) am a Senior Digital Marketing Community Manager at Adobe Systems with over 18 years in the high tech industry. I am also a programmer with knowledge in Java, JavaScript, C#,C++, HTML, XML and ActionScript. If  you would like to see more CQ or other Adobe Digital Marketing end to end articles like this, then leave a comment and let me know what content you would like to see.


TwitterFollow the Digital Marketing Customer Care team on Twitter @AdobeMktgCare.

TwitterFollow me on Twitter @smac2020  

Tuesday, 31 January 2017

Creating an Adobe Experience Manager Newsletter HTL component

You can create an Adobe Experience Manager HTL component that renders a newsletter that you can distribute to an email audience. For example, consider a digital marketer that wants to promote events around a specific product. By creating an AEM newsletter, they can raise awareness of the product.

As an AEM developer, you can create an AEM HTL component that lets an author set all content for a newsletter, including images, text, links to other content such as videos, and so on. The following illustration shows the newsletter created in this development article.


As shown in the previous illustration, the HTL component renders a newsletter that consists of these sections:
  • text and image shown at the start of the newsletter
  • text that provides a summary of the newsletter
  • a repeating data section that contains the body of the newsletter. There can be many sections under the current issue section set by an author.
  • a section that lists previous editions.

 Content for each section can be set by using a different tab in the Touch UI dialog. The following illustration shows the tab that populates the text and image section. 


This article steps you through how to build this AEM newsletter component. To read this article, click https://helpx.adobe.com/experience-manager/using/htl_news.html

To watch the video - see:



Adobe Digital Marketing Community

Join the Adobe Digital Marketing Community. Start by clicking this banner



I (Scott Macdonald) am a Senior Digital Marketing Community Manager at Adobe Systems with over 18 years in the high tech industry. I am also a programmer with knowledge in Java, JavaScript, C#,C++, HTML, XML and ActionScript. If  you would like to see more CQ or other Adobe Digital Marketing end to end articles like this, then leave a comment and let me know what content you would like to see.


TwitterFollow the Digital Marketing Customer Care team on Twitter @AdobeMktgCare.

TwitterFollow me on Twitter @smac2020