I am testing out the LDS feature in Summer 17 Preview org. I have created a component and put it on the account detail page. Component has LDS to fetch the data and some markup to display the fetched data. But nothing shows up.
Code :
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
<aura:attribute name="record" type="Object"/>
<aura:attribute name="recordError" type="String"/>
<force:recordData aura:id="recordLoader"
recordId="{!v.recordId}"
layoutType="FULL"
targetRecord="{!v.record}"
targetError="{!v.recordError}"
/>
{!v.record.Name}
{!v.record.BillingCity}
<aura:if isTrue="{!not(empty(v.recordError))}">
<div class="recordError">
<ui:message title="Error" severity="error" closable="true">
{!v.recordError}
</ui:message>
</div>
</aura:if>
Could someone please help with this.
Best Answer
I was able to display the data on the component with slight modifications. In summer 17 release the structure of the retrieved record using data service is slightly modified and also a new tag has been introduced to make accessing the data simpler. The new structure of data and the new tag introduced are available at this link : https://releasenotes.docs.salesforce.com/en-us/summer17/release-notes/rn_lightning_data_service.htm
There is also a video(from 14 min to 17 min) explaining the use of new tag : https://www.youtube.com/watch?v=2oOthaxzYhE
Modified code looks like:
force:recordData has a new attribute "target fields" which makes it simpler to access data. The value assigned to target fields(fieldstoQuery) is of type object and it is a more simplified way to access data according to the release notes.