I have a custom LWC under the "View Writeup" Tab in my Lightning Record Page. I would like to fire an Event in the LWC anytime the Record Page Tab is selected.
I tried including the event under a renderedCallback however this only fires on the initial selection of the tab. I would like the event to also fire if a User selects another Record Page Tab and then goes back to the "View WriteUp" Tab
JS
import {LightningElement, api} from 'lwc';
import getFiles from '@salesforce/apex/PreviewRelatedPdf_Helper.GetFile';
export default class PreviewRelatedPdf extends LightningElement {
@api recordId;
@api titleSearch;
@api lookupApiName;
renderedCallback() {
this.handleGetFiles();
}
showFile=true;
documentURL;
handleGetFiles(){
getFiles({
recordId: this.recordId,
titleSearch: this.titleSearch,
lookupApiName: this.lookupApiName
})
.then(result =>{
if(result){
this.showFile=true;
this.documentURL = '/sfc/servlet.shepherd/document/download/' + result;
}else{
this.showFile=false;
}
})
.catch(error =>{
this.showFile=false;
console.log('Error = ' + error);
})
}
}