0

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?

4
  • your logout URL would only contain relative URL like /app-landingpage. why would you need to store absolute URL in a custom label?
    – RedDevil
    Commented 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.
    – SatyaV
    Commented 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?.
    – RedDevil
    Commented 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.
    – SatyaV
    Commented May 17, 2017 at 16:59

1 Answer 1

1

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

2
  • 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?
    – SatyaV
    Commented May 17, 2017 at 17:21
  • I dont think this is possible in customlabel.
    – RedDevil
    Commented May 17, 2017 at 17:23

You must log in to answer this question.

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