Skip to content

Instantly share code, notes, and snippets.

@Sunil02kumar
Last active November 14, 2019 12:05
Show Gist options
  • Save Sunil02kumar/ec5aed3ff3ec4a46f4e833d59c6f17ed to your computer and use it in GitHub Desktop.
Save Sunil02kumar/ec5aed3ff3ec4a46f4e833d59c6f17ed to your computer and use it in GitHub Desktop.
Pre-populate Field Values on Standard Pages in Lightning
<aura:component implements="force:appHostable,flexipage:availableForRecordHome,force:hasRecordId" >
<lightning:button name="Create Quick Contact" label="Create Quick Contact" onclick="{!c.createQuickContact}"/>
</aura:component>
({
createQuickContact : function(component, event, helper) {
var createAcountContactEvent = $A.get("e.force:createRecord");
var accid=component.get("v.recordId");
console.log('accid-'+accid);
createAcountContactEvent.setParams({
"entityApiName": "Contact",
"recordTypeId":'0120I000000nhJFQAY',
"defaultFieldValues": {
'Phone' : '415-240-6590',
'AccountId' : accid,
'Email':'dummytest123@gmail.com'
}
});
createAcountContactEvent.fire();
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment