function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Daniele Negroni 11Daniele Negroni 11 

lightning:outputField value (?)

Hey guys,

is there a workaround for getting lightning:outputField "value"?

Look at this code!

UI.cmp

<lightning:outputField fieldName="ExternalCode__c" aura:id="adrExternalCode" />
I've tried to do something like this in the UIController.js
component.find('adrExternalCode').get('v.value');

but it does not work, and i even got an error because component.find('adrExternalCode') is undefined.
 

Wait: i can display the value (through fieldName="ExternalCode__c"), but i can't take it and do anything with it?

Raj VakatiRaj Vakati
Can you give me complete code ? With UI:outputField  you can able to get the value .
Benjamin_MitchellBenjamin_Mitchell
The value is definitely there, but since it's not exposed as a standard lightning component attribute for the lightning:outputField component, you'd have to do something janky to get that value (that may not be reliable in the future).  You may be better off using a different method to show the data, and just tie the record to an attribute that you can easily use component.get("v.--"); on in your javascript controller.