Skip to content

Instantly share code, notes, and snippets.

@melissajhansen
Last active January 16, 2018 16:54
Show Gist options
  • Save melissajhansen/cb119676ed334929e76aae0f2631b0ee to your computer and use it in GitHub Desktop.
Save melissajhansen/cb119676ed334929e76aae0f2631b0ee to your computer and use it in GitHub Desktop.
LDS Error Example
<aura:component implements="forceCommunity:availableForAllPageTypes,force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId" access="public">
<aura:attribute name="contactRecord" type="Contact"/>
<aura:attribute name="recordError" type="String"/>
<aura:attribute name="returnedError" type="String"/>
<force:recordData aura:id="recordLoader"
recordId="{!v.recordId}"
mode="EDIT"
targetFields="{!v.contactRecord}"
targetError="{!v.recordError}"
fields="FirstName, My_Test_Formula__c"/>
<!-- Display Lightning Data Service errors, if any -->
<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>
<div>
{!v.contactRecord.FirstName}
<lightning:button class="slds-button" onclick="{!c.changeNameToSusie}">Change Name</lightning:button>
</div>
<aura:if isTrue="{!not(empty(v.returnedError))}">
{!v.returnedError}
</aura:if>
</aura:component>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment