We are doing some work on integrating AEM as the CMS connection in a Salesforce Lightning Community page using CMS Connect and the Lightning Builder but have run into some issues with the Locker Service security layer for our use-case and are hoping you can provide some assistance.

We currently have the CMS connection set-up so that a path can be specified in the Community Builder to our AEM hosted servlet which will return the correct markup and CSS/JS client-libs for the requested component which renders as expected in the builder. However, we found that Locker Service segregates these returned assets into an isolated DOM container context and restricts the JS of this component from accessing any elements that may be rendered on the actual page's DOM.

The use case we have where the Locker Service's isolating behavior is causing problems is we want to be able to provide a JS file with our top-nav header component that can do the following: Access the actual page DOM and interact with and modify the top-nav component elements that may are rendered on the page. Expose public JS functions that can be called with arguments that are later defined on the builder page. Have the JS be accessible from the actual page DOM and can be called and executed there with access to the real DOM. We'd like to be able to do the above so that a Community page builder in Salesforce has the ability to specify different customizable content that will be injected into the pulled-in top-nav header CMS Connect component.

In one of the webinars we attended there was a mention of Lightning Events that allows components to talk to each other. Would this be the correct approach to support the above use-case and solve the problems we are running into?

Or is there something we are missing or perhaps a different method where this can be done more easily?

2 Answers 2


CMS Connect components are loaded in Locker Service protected, custom namespace for security reasons. Given that CMS Connect runs inside Locker, only global and components from custom namespace is visible to the scripts in CMS connect.

Lightning events can be used to interact with components. You can check for $A which indicates content is being rendered inside lightning context and access Lightning APIs available in $A. e.g $A.get to find an event & fire. https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/events_external.htm has some details.

  • @user55445 Just a follow up on if the above solution work for you? If you are still facing some issue, please share the steps to reproduce or more details on if the custom component is third party package or owned by org admin. Commented Apr 10, 2018 at 19:42

@Shipra Shreyasi

How to find within the CMS content that's rendered whether it's a lightning context or not?

Pl advise.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .