+ Start a Discussion
Tulasiram ChippalaTulasiram Chippala 

How to refresh lightning component placed on opportunity detail page

We are displaying one banner on the Opportunity page. If Opportunity is edited this banner has to be refreshed and call apex method. 
I tried with below code but recursion is happening in page refresh, it is not stopping refresh call.
<aura:handler event="force:refreshView" action="{!c.onSuccessMethod}" />
onSuccessMethod : function(component, event, helper){
        console.log("Loading on Success");
<aura:component controller="PositionsStatus" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:hasSObjectName" 
	<aura:attribute name="statusMessage" type="String" default=""/>
  	<aura:attribute name="ShowMessage" type="boolean" default="true"/>
    <aura:attribute name="sobjecttype" type="String" default="{!v.sObjectName}"/>  
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
	<aura:handler event="force:refreshView" action="{!c.onSuccessMethod}" />

    <aura:if isTrue="{!v.ShowMessage}">
    <div  class="">
        <div aura:id = "barId" class="greenColor slds-notify slds-notify_alert slds-theme_alert-texture">
            <span class="slds-assistive-text ">warning</span>
            <div class="slds-notify__close">  
Please help me with this. Thanks.
ANUTEJANUTEJ (Salesforce Developers) 
Hi Tulasiram,

You can try reloading the page after saving the changes so that the details are updated.

I hope this helps.