Skip to content

Instantly share code, notes, and snippets.

@JitendraZaa
Created July 22, 2017 00:57
Show Gist options
  • Select an option

  • Save JitendraZaa/d1dc71d83cfc9b4776b619a7e7e5aa70 to your computer and use it in GitHub Desktop.

Select an option

Save JitendraZaa/d1dc71d83cfc9b4776b619a7e7e5aa70 to your computer and use it in GitHub Desktop.
View mode of Salesforce Lightning Data Service
<aura:component implements="flexipage:availableForAllPageTypes,
flexipage:availableForRecordHome,force:hasRecordId"
access="global" >
<aura:attribute name="account" type="Object"
description="The record object to be displayed"/>
<aura:attribute name="accountRecord" type="Object"
description="A simplified view record object to be displayed"/>
<aura:attribute name="recordError" type="String"
description="An error message bound to force:recordData"/>
<force:recordData aura:id="record"
layoutType="FULL"
recordId="{!v.recordId}"
targetError="{!v.recordError}"
targetRecord="{!v.account}"
targetFields="{!v.accountRecord}"
fields="Name, Company_Email__c"
mode="VIEW"/>
<div class="slds-box">
<div class="slds-text-heading_medium">
Load Account - Data Service
</div>
<!-- Display a header with details about the record -->
<div class="slds-form--stacked slds-tile">
<div class="slds-form-element">
<label class="slds-form-element__label" >Name: </label>
<div class="slds-form-element__control">
<ui:outputText class="slds-input"
value="{!v.accountRecord.Name}" />
</div>
</div>
<div class="slds-form-element">
<label class="slds-form-element__label" >Company Email : </label>
<div class="slds-form-element__control">
<ui:outputTextArea class="slds-input"
value="{!v.accountRecord.Company_Email__c}" />
</div>
</div>
</div>
</div>
</aura:component>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment