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
Tiwari VedantTiwari Vedant 

Refresh custom lightning component when file is attach to record from 'Files' related list

I want to refresh custom lightning component when file is attach to record from 'Files' related list.
Please suggest how to achieve the same.
VinayVinay (Salesforce Developers) 
Hi Tiwari,

You need to refresh the tab by using event="force:refreshView" in component.
<aura:handler event="force:refreshView" action="{!c.RefreshTab}"/>
In JSController, you need to fire this event in order to refresh the tab after your file gets uploaded.
action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {  
                var result=response.getReturnValue();
                $A.get('e.force:refreshView').fire();

            }

Review below link on usage of 'force:refreshView'

https://developer.salesforce.com/docs/component-library/bundle/force:refreshView/documentation

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
Vinay Kumar