import { LightningElement, track, wire,api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; export default class lexPreviewPDF extends LightningElement { @api recordId; @wire(CurrentPageReference) getStateParameters(currentPageReference){ if(currentPageReference){ console.log(currentPageReference); const IdValue=currentPageReference.state.recordId; if(IdValue){ let str=`${IdValue}`; this.recordId=str; console.log("recordId="+str); } } } connectedCallback(){ this.PreviewPDF().then(res=>{ this.dispatchEvent(new CloseActionScreenEvent()); }); } async PreviewPDF(){ window.open("/apex/ContentPreview?id="+this.recordId, "_blank"); } }