You need to sign in to do that
Don't have an account?

How to Navigate to Community Builder page from custom button click
Hi All.
I am trying to navigate from Component to Community buidler page and tried below code it did not work though I am not getting any error.
The button is not in Lighting app it is in commuity within the lightning component.
I am trying to navigate from Component to Community buidler page and tried below code it did not work though I am not getting any error.
The button is not in Lighting app it is in commuity within the lightning component.
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes"> <lightning:navigation aura:id="navService"/> <lightning:button label="Navigate" onclick="{!c.handleClick}"/> </aura:component>
({ handleClick: function(cmp, event, helper) { var navService = cmp.find("navService"); var pageReference = { "type": "standard__component", "attributes": { "componentName": "c__WebinarOverride" }, "state": { 'message':'This is the target page' } }; navService.navigate(pageReference); } })
({ doInIt : function(component, event, helper) { var id = component.get("v.pageReference").state.message; var toastEvent=$A.get('e.force:showToast'); toastEvent.setParams({ title:'Rendering page', message:id, key:'info_alt', type:'info', mode:'pester' }); toastEvent.fire(); } })
Please refer the below code for the same
For Internal
gotoURL : function (component, event, helper) {
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({ "url": "/006/o" }); // Pass your community URL
urlEvent.fire(); }
For External
navigate : function(component, event, helper) {
//Find the text value of the component with aura:id set to "address" var address = component.find("address").get("v.value");
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({ "url": 'https://www.google.com/maps/place/' + address });
urlEvent.fire(); }
Please mark it as the best answer if it helps you
thanks
All Answers
Please refer the below code for the same
For Internal
gotoURL : function (component, event, helper) {
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({ "url": "/006/o" }); // Pass your community URL
urlEvent.fire(); }
For External
navigate : function(component, event, helper) {
//Find the text value of the component with aura:id set to "address" var address = component.find("address").get("v.value");
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({ "url": 'https://www.google.com/maps/place/' + address });
urlEvent.fire(); }
Please mark it as the best answer if it helps you
thanks
Hope you are doing well.
I just wanted to know can we use custom label(having community url ) to set url attribute of navigateToUrl event?