I have implemented a custom lightning component with recordEditForm and updating opp stagename which accidentally refreshing the page but when i remove stagename input field from the form its working fine and not refreshing the page.

please help this is urgent.


Component Code -

<aura:attribute name="record" type="Opportunity"/>
<aura:attribute name="simpleRecord" type="Opportunity"/>
<aura:attribute name="recordError" type="String"/>


<force:recordData aura:id="recordLoader"

<!-- Display a lightning card with details about the record -->
<div class="Record Details"> 
<lightning:card iconName="standard:opportunity" title="{!v.simpleRecord.Name}" >
    <div class="slds-p-horizontal--small">
        <p class="slds-text-heading--small">
            <lightning:formattedText title="Billing City" value="{!v.simpleRecord.Name}" /></p>
        <p class="slds-text-heading--small">
            <lightning:formattedText title="Billing State" value="{!v.simpleRecord.StageName}" /></p>

<!-- Display Lightning Data Service errors, if any -->
<aura:if isTrue="{!not(empty(v.recordError))}">
    <div class="recordError">

<aura:if isTrue="{!!v.saved}">
        <!-- the messages component is for error messages -->
        <lightning:messages />

        <div class="slds-m-top_medium">
            <lightning:button disabled="{!v.disabled}" variant="brand" type="submit" name="save" label="Save" />

        <lightning:inputField fieldName="Name" />
        <lightning:inputField fieldName="StageName" />
        <lightning:inputField fieldName="Annuity_Project__c" />
        <lightning:inputField fieldName="Deal_Administrator__c" />

    <aura:set attribute="else">            

<aura:if isTrue="{!v.Spinner}">
    <div aura:id="spinnerId" class="slds-spinner_container">
        <div class="slds-spinner--brand  slds-spinner slds-spinner--large slds-is-relative" role="alert">
            <span class="slds-assistive-text">Loading</span>
            <div class="slds-spinner__dot-a"></div>
            <div class="slds-spinner__dot-b"></div>

Controller -

handleSubmit : function(component, event, helper){
     //helper.showSpinner(component, event, helper);

enter image description here

  • Do share the relevant code as well. – itzmukeshy7 Dec 5 '18 at 5:23
  • Please see code updated above and also this work properly when i use this in separate app but when i embed this component on Opportunity record page and submit the form it refresh and when i comment this LOC (stagename) it work properly. – Dildar Hussain Dec 5 '18 at 5:48
  • Try force: refreshView in the success callback. – itzmukeshy7 Dec 5 '18 at 6:08
  • Is whole page refreshing or only a view refreshing? – vignesh Dec 5 '18 at 7:14
  • not the whole browser but content view page and it gets blank. Please see the screenshot. – Dildar Hussain Dec 5 '18 at 10:52

Just thanks to all for your suggestions. I got the root cause of the issue and that was, in the background some old code was executing and changing recordtype which also change the page layout. Now once i inactive that workflow rule its working nice.

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.