2

I have created tabs in the lightning record page. I have given inline VF pages as tabs in a lightning record page. I need to refresh automatically when we edit the record in lightning. Currently, inline vf page is not refreshing automatically. we are refreshing URL then Inline VF page is Updating. Is there any configuration setting to refresh the lighting record page when we edit the lighting record page?

  • Platform events? – Eric Apr 5 '19 at 8:27
1

Why not create a lightning component and put your VF inside it as an iframe?

You lightning component will listen to refreshView event which is fired when some data on lightning changes? It will reload the page.

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >

    <aura:attribute type="String" name="VFPagName" default="MyAccountPage"></aura:attribute>

    <aura:attribute name="src" default="#" type="String"></aura:attribute>

     <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
     <aura:handler event="force:refreshView" action="{!c.doReload}"/>

    <iframe src="{!v.src}" aura:id="myIframe"></iframe> 
</aura:component>

JS:

({


    doInit : function(component, event, helper) {
        var vfPageName = component.get("v.VFPagName");

        component.set("v.src",'/apex/'+vfPageName+'?id='+component.get('v.recordId'));

    },


    doReload : function(component,event,helper){
        var srcBackup = component.get("v.src");   
        component.set("v.src","#");
        component.set("v.src",srcBackup);

    }
})

Also dont find to add the design file so that you provide the pageName and extra params from app builder.

Design:

  <design:component>
        <design:attribute name="VFPagName" label="Your VF Page Name" />
    </design:component>
| improve this answer | |
  • Hai jaiswal, how to use this lightning component?. and what is <design:Componet>? Should i use this lightning component as Quick action or what? – chris Apr 5 '19 at 10:23
  • Just put it in app builder on a recordPage and mention your VFPageName – Pranay Jaiswal Apr 5 '19 at 10:24
  • where should i use <design:component> <design:attribute name="VFPagName" label="Your VF Page Name" /> </design:component> – chris Apr 5 '19 at 10:26
  • Thats your lightning component design file, developer.salesforce.com/docs/atlas.en-us.lightning.meta/… – Pranay Jaiswal Apr 5 '19 at 10:27
  • @chris this is the design file for the lighntnig component, check this screeshot. imgur.com/VezUQXB , its present in the tab below helper – Pranay Jaiswal Apr 5 '19 at 10:36
1

The visualforce page does not listen to the changes you made in any other lightning component available on the record page.

Though you would like to look for embedding Flow (via Visualforce) in Lightning Record Page and it reloading when the record is updated. It might solve your problem.

| improve this answer | |

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.