2

In the doc (https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_dynamic_vf_globals_objecttype.htm) it is said that the SobjectType global variable can be used in lightning component, but when i wrote it like stated , I am obtaining an error :

{!$ObjectType['Account'].fields['MaisonMereRecherche__c'].Label}

where MaisonMereRecherche is my custom field on the account object.

I obtained the following error :

Result: [ERROR]: expecting a positive integer, found ''Account'' at column 13 of expression: $ObjectType['Account'].fields['MaisonMereRecherche__c'].Label: Source

When I tried rewriting it like i used to do in VF like this :

 $ObjectType.Account.fields.MaisonMereRecherche__c.Label

I have no error, but it is not showing on my page.

What am I missing here ? Note that i'm coding on the latest API version (38.0)

  • 1
    I checked the doc link there's no mention of SobjecType being supported in Lightning component. – Praveen Nov 9 '16 at 8:25
  • Meaning it is confirmed that i can't use the ObjectType global variable in lightning components ? Is their a way to use it in lightning controller or helper also??? – vanessen Nov 9 '16 at 8:39
  • I think it's not possible for now. – Praveen Nov 9 '16 at 9:25
2

Ligthning expressions are not the same as visual force expressions.

the list of global value providers are described here

Lightning expression support arrow braces only for accessing arrays, so there expected the integer index

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.