Access Custom Label
“$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:
skuid.utils.mergeAsText("global","{{$Label.Name_Of_Label}}")
That should work according to these links:
http://help.skuidify.com/m/11720/l/187263-global-merge-variables-functions
http://help.skuidify.com/m/11720/l/129517-skuid-utils
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};
console.log(testLabel);
Any other ideas?
KR.
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.
Ryan
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 ?
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?
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
$(document.body).one(‘pageload’,function(){
//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);
});
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.