Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<!--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
You can’t perform that action at this time.