I have a usecase where I want to update some field values at the record before firing the component.find("edit").get("e.recordSave").fire() event.

Here is the markup which I am using

<force:recordEdit aura:id="edit" recordId="0069000000PUrus"/>
<lightning:button label="Save &amp; Next" onclick="{!c.doSaveAction}" />


doSaveAction : function(component, event, helper) {
    // Here, can I update a field value before sending record to save event

Please let me know if it is possible.


I haven't done this with force:recordEdit but I have done it with Lightning:recordEdit so if thats an option you could just switch to that and the code below will allow you to update object fields before they are passed to the server. Otherwise you might be able to apply similar logic to force:recordEdit


<lightning:recordForm aura:id="createCaseForm"
        recordTypeId= "{!v.recordTypeId}" 


doSaveAction : function(cmp, event, helper) {
    event.preventDefault(); // stop form submission
    var eventFields = event.getParam("fields"); // gets all the fields for the object
    eventFields["AccountId"] = cmp.get("v.accountId");
    eventFields["ContactId"] = cmp.get("v.contactId");
    eventFields["Status"] = "In Process";
| improve this answer | |
  • Will it create the layout automatically as per the record type? – Naval Sharma Jan 16 '19 at 15:34
  • Yes, it will grab the page layout based on record type. I also discovered a way to hide specific fields like recordId, let me know if you run into that issue and I'll send it your way – Calvin OKeefe Jan 16 '19 at 15:44
  • any luck getting it to work? – Calvin OKeefe Jan 17 '19 at 16:35
  • pls mark this answer as the correct answer if this worked – Calvin OKeefe Jan 23 '19 at 18:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.