function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Giriraj G PatilGiriraj G Patil 

Data is not getting refresh on product detail page

Hi All,

After editing the opportunity product details in the edit lightning component, the updted details are not popolating on the product detail page. In the code snippet we are explicitly calling 
setTimeout(function() {
            $A.get('e.force:refreshView').fire();
        }, 1000);
and given the time as 2000. Then also the detail page is not populating the latest updated values.

This behaviour is observed after the Winter'20 Salesforce release .

Kindly suggest any workaround.. 
Mathias SandMathias Sand

Hi Giriraj,
We are facing the same issue in sandboxes after Winter '20 Salesforce release.
Did you get this solved or any working workaround?

Kind regards

Giriraj G PatilGiriraj G Patil
Hi Mathias,

I think now the issue has gone and I could see the updated values on the product details page. Some fix might have done from the salesforce side.

There is no specific thing we have implemented to wor it. But just as work around we tried couple of ways

1. Instead of moving the product detail page try loading through navigateToURL() and provide the recordId

//var recordID = get the recordID where you want to move
var eUrl= $A.get("e.force:navigateToURL");
eUrl.setParams(
{ "url": 'Your_CustomURL'+recordID }
);
eUrl.fire();

2. Create a dummy lightning componnet like below
     <aura:component implements="flexipage:availableForAllPageTypes"  access="global">
    <aura:handler name="init" value="{!this}" action="{!c.handleInit}"/>
</aura:component>

Controller code:
({
    handleInit : function(component, event, helper) {
        setTimeout(function(){ 
            $A.get('e.force:refreshView').fire();
        }, 1);
    }
})

In this case when you use "e.force:navigateToSObject" the layout is refreshed.
3. Instead of using var navEvt = $A.get("e.force:navigateToSObject"); you can use the standard__recordPage

Before
 navigateToProductDetail: function(component) {        
        var navEvt = $A.get("e.force:navigateToSObject");
        navEvt.setParams({
            "recordId": component.get("v.product_ID")
        });
        navEvt.fire();
        setTimeout(function() {
              $A.get('e.force:refreshView').fire();
        }, 1000);
    }

Change to
navigateToProductDetail: function(component) {       
        var navService = component.find("navService");
        var prodId = component.get("v.pageReference").state.c__product_ID;
           
        navService.navigate({
            type: 'standard__recordPage',
            attributes: {
                recordId : prodId, // Hardcoded record id from given objectApiName
                actionName: 'view',  //Valid values include clone, edit, and view.
                objectApiName: 'OpportunityLineItem' //The API name of the record’s object
            }}, true);
}