You need to sign in to do that
Don't have an account?
Tony Rissone
Aura attribute, set default value based on record data
Basically i have an attribute in an aura component that i want to be dynamic based on the record the component in embedded in.
Now i know how to get record data into a aura component 'force:recordData'. Would it be like:
<aura:attribute name="user" type="String" default=the ownerId/>
Now i know how to get record data into a aura component 'force:recordData'. Would it be like:
<aura:attribute name="user" type="String" default= {!v.accountRecord.OwnerId}/> <force:recordData aura:id="recordLoader" recordId="{!v.recordId}" fields="OwnerId" targetFields="{!v.accountRecord}" targetError="{!v.recordLoadError}" />
You need to store it in an attribute of type object and then use this attribute to get these values.
For example SimpleRecord attribute of type object and then we are showing the specific values Name, BillingCity, BillingState in lightning:formattedText using v.simpleRecord.BillingState, v.simpleRecord.BillingCity, v.simpleRecord.Name
I don't think you would be able to assign the values directly as mentioned in the above example and also on https://trailhead.salesforce.com/en/content/learn/v/modules/lightning_data_service/lightning_data_service_manipulate_records
Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Thanks.