I have a lightning component which has implemented lightning:isUrlAddressable interface. This component is called from a custom button present on Account and I'm also passing Account Id in the URL of the component.

Inside my lightning component, I have lightning:recordEditForm I auto-populate some values based on the values present on the URL.

On hard refresh, I'm seeing refreshed values but without any hard refresh on subsequent button click, I'm seeing the same old values in my recordEditForm even though my URL parameter values are changing.

I tried to refresh the view in the onLoad event of recordEditForm, but it's causing an infinite loop. I tried to populate fields in init, but it's still not taking it.

Is there a way to populate correct values on every button click?


<aura:attribute name="parentId" type="string" default=""/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />

    <lightning:recordEditForm objectApiName="Order"
<lightning:inputField fieldName="AccountId" aura:id="accId"/>
                <lightning:button type="button"  name="cancel" label="cancel" onclick="{!c.cancel}"/>
                <lightning:button type="submit"  name="update" label="Update"/>


doInit : function(cmp) {
    console.log('>>> pageReference... '+cmp.get("v.pageReference").state.c__parentId);
        var accountId = cmp.get("v.pageReference").state.c__parentId;
        cmp.find('accId').set('v.value', accountId);

My Button URL:


When you're closing the form/component, please add - force:refreshView event, so that it'll force LDS to update the data.

This was triggered in my components with similar set. When user performs save operation, we used to navigate back to list view and from list view on New button, it used to show older data.

Now we're triggering force:refreshView trigger, post submit and prior to redirection, and it is working now.

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.