function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

On Community Builder e.force:navigateToComponent not working?

I have created some lightning components in sandbox and when i go to the community its not working not navigating to another component.
Why this is happening ?? what is the workaround??
NagendraNagendra (Salesforce Developers) 
Hi Mk,

According to the Lightning Components Developer Guide , this functionality requires that the target component's access attribute is set to "global". It also notes that it is only available in Lightning Experience and Salesforce1. So it's not yet available for Communities.

If you try it outside of a community, you may find that what you have is working. That can at least let you know your code is able to function as intended.

One possible approach to "navigate" to a component within a community is to use a container component that includes {!v.body} in its markup, and use $A.createComponents() to dynamically create the desired component and set it as the {!v.body} of the container component.

See Dynamically Creating Components for more info on this.

Hope this helps.

Kindly mark this as solved if the reply was helpful so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.

Hi Nagendra,
Thank you for rply,
The first link of lightning developer guide is not available there i am not able to set attribute global.
Can u provide one example?
Narender Singh(Nads)Narender Singh(Nads)
Hi MK,
In the latest release of salesforce the use of force:navigateToComponent is depreciated. Instead the component you want to navigate to must implement lightning:isUrlAddressible.
Watch this developer preview for a demo for how to navigate between components:

Check out the release notes for more insight.

Let me know if it helps