Skip to main content

Development

Integration AEM with Salesforce – Part1

Salesforce is a customer relationship management tool (CRM), which is used to help companies manage and promote the relationship with existing clients, and develop new clients. It runs on cloud, so there is no need to install any software and no hardware is required. Apparently, it reduces the development cost and can deliver an application in a very short time. Currentl, Salesforce is a leading on-demand CRM in market. Thus, integration with Salesforce is more common when we build sites or systems. This series of articles mainly focuses on how to integrate AEM with Salesforce from AEM’s Cloud Service and its OOTB component to custom components with the Salesforce API.

I noticed that Adobe AEM already provides its extendable capabilities (Cloud Service) to integrate with Salesforce and it also provides OOTB components to show data from Salesforce. There is an article on this topic on its helper hub. However, this article is not a perfect one, there are some mistakes that may prevent developers from a successful integration. Thus, I wrote this article to show the correct steps. I hope this article may help you when you are trying to get the AEM Cloud Service to integrate with Salesforce.

Configuring AEM to integrate with Salesforce

You will need the customer secret and customer key to remote login to Salesforce. Salesforce provides an application named Connected App for remote access. In AEM, it provides Salesforce Cloud Service to config integration with Salesforce.

1.Create a Connected App in Salesforce

Login to your Salesforce org.

Navigate to Create -> Apps.

Click the new button in Connected Apps section to create a new one.

Fill in required details as shown in below images. The callback URL here accepts only HTTPs URLs, so AEM must be SSL configured. The callback URL is the URL of the cloud service that we will create in AEM.Integration AEM with Salesforce – Part1

You will get the customer key and customer secret once you click save.Integration AEM with Salesforce – Part1

2.Configure Salesforce Cloud Service in AEM

Go to Cloud Service. In Third-Party Services, click Configure Now in Salesforce.

Create a new configuration and get the application URL, which is the Callback URL in Connected App configuration.

Integration AEM with Salesforce – Part1

Fill in the customer key and customer secret that you got from Salesforce Connected App.

3.Connect to Salesforce

Click Connect to Salesforce button and the below module pops up.

Integration AEM with Salesforce – Part1

Then a confirmation dialog opens to tell that the connection succeeded.

Integration AEM with Salesforce – Part1

Try the OOTB component in AEM to access data in Salesforce

There is a OOTB component named Salesforce.com Search in AEM, which shows how to use Salesforce REST API to access salesforce objects.

1.Set the created Salesforce Cloud Service onto your site

Integration AEM with Salesforce – Part1

2.Drag the Salesforce search component to the page. Set search criteria in dialog.Integration AEM with Salesforce – Part1

Then, you will get the matched Lead data from Salesforce.

Integration AEM with Salesforce – Part1

Tips:

  1. The Callback URL should be https. Therefore, you have to enable SSL on AEM. To learn how to enable SSL, please refer to this blog.
  2. What to do if you are getting the below error while connecting to Salesforce.Integration AEM with Salesforce – Part1

One possible reason is that you are trying to login to a Salesforce sandbox. Salesforce sandbox has a different login URL (test.salesforce.com) from Salesforce developer and the production environment(login.salesforce.com). However, in AEM, the salesforce connector sets the authorization URL to https://login.salesforce.com/services/oauth2/token. So, for a sandbox environment, please change this value to https://test.salesforce.com/services/oauth2/token in /libs/mcm/salesforce/components/salesforcepage/dialog/items/tabs/items/basic/items/authorizationUrl.

Integration AEM with Salesforce – Part1

Reference:

https://docs.adobe.com/docs/en/aem/6-2/administer/integration/third-party-services/salesforce.html

http://www.aemquickstart.in/2017/03/enable-ssl-for-aem-author-instance.html

Thoughts on “Integration AEM with Salesforce – Part1”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Christine Wang

More from this Author

Categories
Follow Us
TwitterLinkedinFacebookYoutubeInstagram