Connecting the Salesforce Cloud Service in AEM to Export Leads

You have a Salesforce account, and you have Adobe Experience Manager 5.6 (AEM formerly Adobe CQ). You know there is a way to connect AEM to Salesforce, but you are not sure how.

This is a guide on how to connect your AEM to your Salesforce.

The Salesforce cloud services connector on AEM with out-of-the-box workflow model can be used to export leads gathered through your website hosted on AEM into your Salesforce account.

Create the Salesforce configuration through the Cloud Services utility. This can be found in the new touch-optimized UI under Tools in the CQ Operations section. In the classic Welcome screen, it is the top option on the right of the screen.



The third product down is Salesforce. Click on it to expand out the options. If no configuration is set up, you are given two options. Learn More takes you to Configure Now allows you to create a configuration. After a configuration is created, expanding the options gives a list of configurations that can be edited and the option to add more.



Create the configuration. Give it a Title and an optional Name.



After you click the create button, the configuration page with the edit dialog will open. Here you enter your Salesforce information. The Login URL will be pre-populated and should not need to be changed. The Customer Key and Customer Secret can be obtained from your Salesforce account.



Log in to your Salesforce account. Click on your name and click Setup. Under App Setup > Develop click Remote Access.



Create a new Remote Access Application. Fill in the required fields. The callback URL must be on a domain that is accessible to Salesforce. You can use localhost for local development. The callback URL is of the form: https://localhost:4502/etc/cloudservices/salesforce/salesforce.html.

On the Details page for the Remote Access Application, at the bottom, you get the values to put in the Customer Key and Customer Secret inputs for the AEM Salesforce configuration.

Note: On Salesforce they use the term Consumer Key and Consumer Secret.



Now you have a Salesforce configuration set up in AEM. To use it, you need to set it to be used in the Export workflow model. Navigate to Workflows. In the new touch UI, workflows are located under Tools > CQ Operations. In the Classic Welcome screen, it is the second from the top on the right side.





Find the workflow model Export around row 30. Depending on workflows that have been set up, the number may differ. Double-click on it to open the edit view.



Double-click on the step Export.



In the dialog, select the tab Arguments. Select the configuration you have created.



Now the workflow model is set up to export leads into your Salesforce account. A node that is run through this workflow will have the properties examined and be exported to Salesforce based on a mapping that can be configured through the OSGi Console.



The details on how you trigger the workflow and how and where you gather the data to be exported can be in any number of ways. The following is an example of what can be done:

To gather lead information you can create a form on a Web page to which the potential lead will navigate. They enter their information into the form and click Submit. When the form is submitted, it gets sent through an XHR call to a servlet that creates a node in a secure section of the repository (not open to the public). The node uses the email address as the name. There is a workflow launcher set to launch the Export workflow when a node is created under the choosen path to store the data. The node gets the lead’s information set as properties with the appropriate names as set in the OSGi Salesforce Configuration.