function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Admin DNAAdmin DNA 

invoke lightning:EditForm i have to refresh to save

Hi,
when I invoke lightning:EditForm in a Component I have always to refresh and reedit record to save succesfully.
Thank in advance.
Here my component
<aura:component implements="force:appHostable,forceCommunity:availableForAllPageTypes" controller="updateLead" access="global">

<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>  
<aura:attribute name="lead" type="Lead" />
<aura:attribute name="stato" type="String" /> 
<aura:attribute name="isOpen" type="boolean" default="false"/>
<aura:attribute name="isOpenEdit" type="boolean" default="false"/>
<aura:attribute name="isOpenResp" type="boolean" default="false"/>
<aura:attribute name="title" type="String" />
<aura:attribute name="currentUser" type="User" />
    <force:recordData fields="Name, MobilePhone"
        recordId="{!$SObjectType.CurrentUser.Id}"
        targetFields="{!v.currentUser}"
        mode="VIEW"
    />    
    
    
        <lightning:card title="{!v.title}" iconName="standard:lead">
        <aura:set attribute="actions">
            
            <lightning:buttonGroup >
   
      
 <lightning:buttonMenu iconName="utility:close" alternativeText="Close" onselect="{!c.saveStatus}" title="Chiudi" >
    
     <lightning:menuItem label="Fake" value="Fake"/>
    <lightning:menuItem label="Non Contattabile" value="Not Contactable" />
     <lightning:menuItem label="Risponde Altra Persona" value="Risponde Altra Persona" />
	</lightning:buttonMenu> 
  
        <lightning:button iconName="utility:missed_call" onclick="{!c.openModel}" />
                <lightning:button iconName="action:check" onclick="{!c.respond}" />



    </lightning:buttonGroup>

        </aura:set>
        <!-- Grid Three Column -->   
<div class="slds-grid slds-gutters">
  <div class="slds-col ">
            <p class="slds-p-horizontal_small">
<dl class="slds-list_stacked">
    <dt class="slds-item_label slds-text-color_weak slds-truncate">Nome:</dt>
    <dd class="slds-item_detail slds-truncate">{!v.lead.FirstName}</dd>
    <dt class="slds-item_label slds-text-color_weak slds-truncate">Cognome:</dt>
    <dd class="slds-item_detail slds-truncate">{!v.lead.LastName}</dd>
    <dt class="slds-item_label slds-text-color_weak slds-truncate">Professione:</dt>
    <dd class="slds-item_detail slds-truncate">{!v.lead.Professione__c}</dd>
    <dt class="slds-item_label slds-text-color_weak slds-truncate">Campagna:</dt>
  	<dd class="slds-item_detail slds-truncate">{!v.lead.LeadSource} {!v.lead.CampaignID}</dd>
            </dl>
            </p>
  </div>
  <div class="slds-col">
            <p class="slds-p-horizontal_small">
<dl class="slds-list_stacked">
    <dt class="slds-item_label slds-text-color_weak slds-truncate">Cellulare:</dt>
  	<dd class="slds-item_detail slds-truncate">{!v.lead.MobilePhone}</dd>	
    <dt class="slds-item_label slds-text-color_weak slds-truncate">Telefono:</dt>
  	<dd class="slds-item_detail slds-truncate">{!v.lead.Phone}</dd>

    <dt class="slds-item_label slds-text-color_weak slds-truncate">Email:</dt>
  	<dd class="slds-item_detail slds-truncate">{!v.lead.Email}</dd>

            </dl>
            </p>
  </div>

            
            </div>
<div class="slds-clearfix slds-p-right_medium">
  <div class="slds-clearfix">
    <div class="slds-float_right">
      <lightning:buttonIcon iconName="utility:edit" variant="bare" onclick="{!c.openModelEdit}" /> 
    </div>
  </div>
</div>
 

    </lightning:card>
    
<!--###### MODAL BOX CALL ######--> 
  <!--Use aura:if tag to display Model Box, on the bese of conditions. [isOpen boolean attribute] -->   
    <aura:if isTrue="{!v.isOpen}">
      <div role="dialog" tabindex="-1" aria-labelledby="header99" class="slds-modal slds-fade-in-open ">
        <div class="slds-modal__container">
          <!-- ###### MODAL BOX HEADER Part Start From Here ######-->
          <div class="slds-modal__header">
            <button class="slds-button slds-modal__close slds-button--icon-inverse" title="Close" onclick="{!c.closeModel}">
            X
            <span class="slds-assistive-text">Chiudi</span>
            </button>
            <h2 id="header99" class="slds-text-heading--medium">Registra una Chiamata</h2>
          </div>
          <!--###### MODAL BOX BODY Part Start From Here ######-->
          <div class="slds-modal__content slds-p-around--medium">
            <p><c:LogACall recordId="{!v.lead.Id}" username="{!v.currentUser.Name}" usermobile="{!v.currentUser.MobilePhone}"/>
            </p>
          </div>

        </div>
      </div>
      <div class="slds-backdrop slds-backdrop--open"></div>
    </aura:if> 
<!--###### MODAL BOX Part END Here ######-->  
       
    
    
<!--###### MODAL BOX EDIT ######--> 
  <!--Use aura:if tag to display Model Box, on the bese of conditions. [isOpen boolean attribute] -->   
    <aura:if isTrue="{!v.isOpenEdit}">
      <div role="dialog" tabindex="-1" aria-labelledby="header99" class="slds-modal slds-fade-in-open ">
        <div class="slds-modal__container">
          <!-- ###### MODAL BOX HEADER Part Start From Here ######-->
          <div class="slds-modal__header">
            <button class="slds-button slds-modal__close slds-button--icon-inverse" title="Close" onclick="{!c.closeModelEdit}">
            X
            <span class="slds-assistive-text">Chiudi</span>
            </button>
            <h2 id="header99" class="slds-text-heading--medium">Modifica Lead</h2>
          </div>
          <!--###### MODAL BOX EDIT ######-->
          <div class="slds-modal__content slds-p-around--medium">
            <p>  <lightning:recordEditForm recordId="{!v.lead.Id}" objectApiName="Lead" >
        <lightning:messages />
        <lightning:inputField fieldName="FirstName" />
        <lightning:inputField fieldName="LastName" />
        <lightning:inputField fieldName="MobilePhone" />
                <lightning:inputField fieldName="Phone" />
        <lightning:button class="slds-m-top_small" variant="brand" type="submit" name="update" label="Salva" />
    </lightning:recordEditForm>
            </p>
          </div>
       
        </div>
      </div>
      <div class="slds-backdrop slds-backdrop--open"></div>
      <!--###### MODAL BOX Part END Here ######-->  
 </aura:if>        
    
    

</aura:component>

and the controller
({
	doInit : function(component, event, helper) {
		var createddate =  component.get("v.lead.CreatedDate")
        createddate = ($A.localizationService.formatDate(createddate, "DD MMMM YYYY, kk:mm"));
        component.set("v.title", createddate);
	},
    
    saveStatus: function(component, event, helper) { 
        
        var status = event.detail.menuItem.get("v.value");
        component.set("v.lead.Status", status);
        var lead = component.get("v.lead");
        var action = component.get("c.saveLead");
        action.setParams({
    		leadupd : lead,

});
        $A.enqueueAction(action);
        $A.get('e.force:refreshView').fire();
        
    },
    
 navigate : function (component, event, helper) {
    var navEvt = $A.get("e.force:navigateToSObject");
    navEvt.setParams({
      "recordId": component.get("v.lead.Id"),
      "slideDevName": "related"
    });
    navEvt.fire();
},
    
    
         //Modal popup
 openModel: function(component, event, helper) {
      // for Display Model,set the "isOpen" attribute to "true"

     component.set("v.isOpen", true);
   },
 
          //Modal popup
 openModelEdit: function(component, event, helper) {
      // for Display Model,set the "isOpen" attribute to "true"

     component.set("v.isOpenEdit", true);
   },
    
  respond: function(component, event, helper) {
     var editRecordEvent = $A.get("e.force:editRecord");
    editRecordEvent.setParams({
         "recordId": component.get("v.lead.Id")
   });
    editRecordEvent.fire();
  },
   closeModel: function(component, event, helper) {
      // for Hide/Close Model,set the "isOpen" attribute to "Fasle"  
      component.set("v.isOpen", false);
       $A.get('e.force:refreshView').fire();
   },
    
       closeModelEdit: function(component, event, helper) {
      // for Hide/Close Model,set the "isOpen" attribute to "Fasle"  
      component.set("v.isOpenEdit", false);
           $A.get('e.force:refreshView').fire();
       },


})