Expand my Community achievements bar.

Integrating Lighting out Salesforce with AEM

Avatar

Level 3

Hi,

 

I wanted to integrate AEM with Salesforce via leveraging Lighting out.

 

Any help would be appreciated.

 

Thanks!

1 Reply

Avatar

Community Advisor

1. Set Up a Lightning Out App in Salesforce

  • Create a Lightning Out App:

    • In Salesforce, navigate to Setup and search for Lightning Components.
    • Develop a Lightning component that encapsulates the desired functionality.
    • Create a Lightning application that includes this component and is marked as ltng:allowGuestAccess="true" to permit external access.
  • Enable CORS in Salesforce:

    • In Setup, search for CORS.
    • Add your AEM domain to the list of allowed origins to enable cross-origin requests.

2. Configure AEM to Host Salesforce Components

  • Create an AEM Component:

    • Develop a custom AEM component that will host the Salesforce Lightning component.
    • Include a placeholder <div> in the component's HTML where the Lightning component will render.
  • Include Salesforce Lightning Out Javascript&colon;

3. Initialize and Render the Lightning Component in AEM

  • JavaScript Initialization:
    • In the AEM component's client library, add JavaScript to initialize and render the Lightning component:
      javascript
      $A.createComponent( "c:YourLightningComponent", {}, function(cmp) { cmp.set("v.attributeName", "value"); cmp.render(); } );

4. Handle Authentication and Security

  • Salesforce Authentication:

    • Ensure that the Salesforce session is authenticated. This may involve setting up OAuth flows or using existing session cookies.
  • AEM Configuration:

    • Configure AEM to allow the necessary scripts and handle any cross-origin resource sharing (CORS) issues.