Adobe AEM provide its extendable capabilities to integrate with other products. Below demonstration describe how to connect Adobe AEM with Salesforce which is the market’s leading cloud based CRM System. AEM provide OOTB components for the integration purpose. It helps the organization to target the customers through web channels as per their status in CRM.
Steps to Connect to Salesforce:
AEM uses OAuth mechanism to connect to Salesforce. So , first we need to create an connected app inside salesforce to get customer secret and access token.
Go tologin.salesforce.com. Click on Setup on the top right corner. Search for Apps and create a custom app. Fill in required details as shown in below images. Callback Url here accept only https urls, so our AEM must be SSL configured. Check here how to configure SSL in AEM. Callback url is the url of cloud service that we will create in AEM.
Create new custom app |
Fill in the required details.
Select an image for your app.
Choose the required tabs for your custom app.
Choose the user profile for which the custom app will be visible in the Force.com AppExchange menu. You can make a custom app as the default custom app of the profile. If a custom app is set as the default for a profile, then you cannot make it invisible for that profile.
Create a new connected app.
Search for apps in setup. Goto apps, scroll down to Connected apps section and create a new connected app.
- Fill all the required fields.
- Enable OAuth settings
- Enter the callback url. Callback url should be HTTPS. Check here how to enable HTTPS in AEM.
- Select the OAuth scopes. Connection may not be established if scopes are not selected appropriately. Connection was not successful when I have selected only "Full Access". So I selected all the OAuth scopes.
- Click on Manage button and Enable IP relaxation.
- Take a note of consumer key and consumer secret. We need to enter these values in Salesforce cloud configuration in AEM.
Thats all your salesforce app is create. Now lets establish connection from AEM to Salesforce.
Create a salesforce cloud configuration:
Login to your AEM instance and navigate to http://localhost:4502/miscadmin#/etc/cloudservices/salesforce. Click on new and create a new cloud configuration.
Double click on the newly created cloud service configuration to edit. Login url will be auto populated on the dialog. Enter customer key and customer secret and click on connect to salesforce. If connection is successful, then success alert will be displayed as shown below.
Troubleshooting:
- Callback url should be HTTPS. Check here how to enable HTTPS in AEM.
- Callback URL should be fully qualified path of your configuration page with extension.
- If we get this error response{"error":"invalid_grant","error_description":"authentication failure"} then check the authorization_url value. This value is hardcoded in the dialog in connector. So when we try to connect to ****.salesforce.com it tries to establish connection to login.salesforce.com.
- Adobe saleforce connector uses TLS 1.0 to connect to salesforce. Salesforce disabling TLS 1.0. Salesforce is requiring an upgrade to TLS 1.1 or higher by July 22, 2017. After clicking connect to salesforce, check browser console logs to see if any errors.
- Salesforce connector may not be able to connect succesfully if AEM is behind a proxy. Enable proxy in Open Day Commons HTTP Client 3.1 and Apache HTTP Components Proxy Configuration.If that doesn't work then you may need to extend the connector and modify SalesforceClient.java.
- Salesforce takes 5-10 min to enable the app after creation, so connect CQ with Salesfore after that.
By now you will be able to establish connection to Salesforce.