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?

1
  • Platform events?
    – Eric
    Commented Apr 5, 2019 at 8:27

2 Answers 2

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>
7
  • 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
    Commented Apr 5, 2019 at 10:23
  • Just put it in app builder on a recordPage and mention your VFPageName Commented Apr 5, 2019 at 10:24
  • where should i use <design:component> <design:attribute name="VFPagName" label="Your VF Page Name" /> </design:component>
    – chris
    Commented Apr 5, 2019 at 10:26
  • Thats your lightning component design file, developer.salesforce.com/docs/atlas.en-us.lightning.meta/… Commented Apr 5, 2019 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 Commented Apr 5, 2019 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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .