Skip to content

Instantly share code, notes, and snippets.

@simpluslabs
Created November 13, 2018 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simpluslabs/6854b2eb9a7f734eede11dab47e3d862 to your computer and use it in GitHub Desktop.
Save simpluslabs/6854b2eb9a7f734eede11dab47e3d862 to your computer and use it in GitHub Desktop.
<!--forceRecordDataComp-->
<aura:component implements="flexipage:availableForRecordHome, force:hasRecordId">
<aura:attribute name="newContact" type="Object"/>
<aura:attribute name="simpleNewContact" type="Object"/>
<aura:attribute name="newContactError" type="String"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<!--create record in force record start-->
<force:recordData aura:id="contactRecordCreator"
targetRecord="{! v.newContact}"
targetFields="{!v.simpleNewContact}"
targetError="{!v.newContactError}"
layoutType="FULL"
/>
<div>
<lightning:card iconName="action:edit" title="Edit Account">
<div>
<lightning:input aura:id="contactField" label="First Name" value="{!v.simpleNewContact.FirstName}"/>
<lightning:input aura:id="contactField" label="Last Name" value="{!v.simpleNewContact.LastName}"/>
<lightning:input aura:id="contactField" label="Title" value="{!v.simpleNewContact.Title}"/>
<br/>
<lightning:button label="Save Contact" variant="brand" onclick="{!c.handleSaveContact}"/>
</div>
</lightning:card>
</div>
<!--create record in force record end-->
<!-- Display Lightning Data Service errors, if any -->
<aura:if isTrue="{!not(empty(v.newContactError))}">
<div class="recordError">
{!v.recordError}</div>
</aura:if>
</aura:component>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment