I am referring to Logout Url in a Lightning component(in Sandbox which is specific to its own Org.). Is there a way I can make use of Custom Labels in Sandbox Org. to get to the logout URL? If yes, if I deploy this label via Change sets to Production environment, will it work without any regression?
-
your logout URL would only contain relative URL like /app-landingpage. why would you need to store absolute URL in a custom label?– RedDevilCommented May 17, 2017 at 16:42
-
So, when I deploy a Lightning component, as end user's don't have knowledge on coding to edit the URL inside a Lightning JS file, I want it to make it easier. Thus thought of having a custom label which we can deploy along with component. Also I am not sure, if this label can be created to get values dynamically when we are referring them. Hope I didn't confuse you.– SatyaVCommented May 17, 2017 at 16:47
-
a bit :) but i will try to answer it in the best possible way. Yes you can access the label dynamically inside javascript(helper,controller). Do you need the syntax for it?.– RedDevilCommented May 17, 2017 at 16:49
-
I wanted to generate the URL dynamically in any Salesforce instance by just referring to the custom label which contains a formula/whatever config.– SatyaVCommented May 17, 2017 at 16:59
1 Answer
Using below syntax you can access the custom label in javascript controller/helper.
$A.get("$Label.c.CPval");
Remember that if you are going to put complete URL in your custom label then the custom label has to be changed once you deploy the labels to another sandbox,an example if its https://dev-prodecom.com/dev-logout,then domain dev- will change in another sandbox so it needs to be modified again. Instead what you could do is use a relative URL /dev-logout and this will not need modifications
-
Bro, this is helpful. BUT, While creating a Custom label, can have some data binding in the value? For instance:
{!URL}/secur/logout.jsp?retUrl={!PortalURL}/logout
. This way, if I can deploy this custom label, I really don't need to be changing any values. Does this make sense?– SatyaVCommented May 17, 2017 at 17:21 -