I have a lightning component similar to:

    <aura:handler name="myevent" action="{!c.myRerender}" />

    <lightning:recordViewForm recordId="{!v.recordId}" objectApiName="MyObj__c" />

How can I get my <lightning:recordViewform> to reload? Usinge.force:refreshView` is not a viable answer as it reloads other things as well.

  • 1
    Did you try loading lightning:recordViewForm with a separate component using $A.createComponent ? – codeyinthecloud Jan 14 '19 at 19:41
  • Not a duplicate as this use case is different and not answered in that question. – dphil Jan 14 '19 at 19:58
  • 1
    @dphil, including + code and what you have tried will likely reduce the chances of your posts being marked as duplicates. – glls Jan 14 '19 at 22:24
  • @codeyinthecloud I have not. Maybe I'll try that next. – dphil Jan 15 '19 at 14:45
  • For those that closed this, that linked question/answer does NOT answer this question/cover this scenario. – dphil Jan 16 '19 at 19:51

Because the recordEditForm stores the object in the DOM it will not automatically update unless it is re-pulled from server. To do this just set the recordId attribute of the recordEditForm to null and then back to the correct record Id and it will grab the updated version of the record


<aura:attribute name="recordId" type="Id"/>
<aura:handler name="myevent" action="{!c.myRerender}" />
<lightning:recordViewForm recordId="{!v.recordId}" objectApiName="MyObj__c">


myRerender : function(cmp, event, helper){
    var recId = cmp.get('v.recordId');
    cmp.set('v.recordId', null);
    cmp.set('v.recordId', recId);
  • Have you tested this solution? I had approached my co-workers with this exact same solution and they had said they already tried this and it did not work. – dphil Jan 14 '19 at 20:03
  • I have used the handler on the refreshView event before and I know that changing an aura:if statements boolean value refreshed that part of the DOM – Calvin OKeefe Jan 14 '19 at 20:05
  • Thanks, I'll try it myself and see if it works then. – dphil Jan 14 '19 at 20:05
  • There is also the renderer.js aspect of lightning components which may be the preferred method of re-rendering the DOM but I've never gotten that to work right. developer.salesforce.com/docs/atlas.en-us.lightning.meta/… – Calvin OKeefe Jan 14 '19 at 20:07
  • 1
    Your next idea worked. If you wanted to put it into an answer I can accept it. – dphil Jan 15 '19 at 17: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.