How do I access salesforce custom labels in a snippet? I tried $A.get("$Label.Name_Of_Label") but it

edited October 31, 2016 in Questions
Access Custom Label


  • edited July 31, 2015
    "$A" is the shorthand for Aura in lightning components, I don't think that will work with skuid, I think you want something like this:
    That should work according to these links:
  • edited September 24, 2015
    Hi Moshe,

    I tried these approaches but they doesnt seem to be working. I am looking to use the labels in javascript. 

    I tried something like this but no luck. 

    var testLabel = {$Label.LABEL_NAME};

    Any other ideas?

  • edited October 31, 2016
    Hi Kalyan,

    Moche's approach works for me. 

    You will need to add the Custom Label to the Skuid page first before it can be accessed by this method or in a merge template, otherwise that method will just return an empty string. 

  • edited October 31, 2016
    Hi Ryan,

    I am trying to access a label as shown below:

    var specialSegment = skuid.utils.mergeAsText("global","{{$Label.Special_Partner}}");

    but have got an error saying :
    skuid__SkuidJS:26 Uncaught TypeError: Cannot read property 'organizationId' of undefined

    Any idea on how to utilize this method from utils ?
  • edited October 21, 2016
    Hi Kvin,

    That code looks okay. 

    Are you sure your error isn't being thrown by a different line of code? Look for a line that attempts to access a field called organizationId on an object. 

    Have you tried debugging using console.log or alert statements?
  • edited October 31, 2016
    Hi Ryan,

    Thanks for taking time to respond on this.
    I got this working.

    The reason was : The Skuid.utils.userInfo object is only available once the page is loaded.

    So if you intend to access this in "inline" snippet

    //Here you should be able to access as shown below
     var specialSegment = skuid.utils.mergeAsText("global","{{$Label.Special_Partner}}");    console.log('specialSegment from Label',specialSegment);


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!