Skip to main content
added 10 characters in body
Source Link

I have an lwc action button that loads the popup. When i load the component for first time, recordId is present. But when i close and open it again(without reloading the whole page), recordId is lost. Kindly advise

export default class EmeaSubmitEvalRequest extends LightningElement {
_recordId;

@api recordId;set recordId(value) {
    this._recordId = value;
    console.log('in setter',this._recordId);
}

get recordId() {
    return this._recordId;
}
constructor(){
    super();
    console.log('constrcu',this.recordId);//not printed at all
}
connectedCallback(){
    console.log('connected recid',this.recordId);//not printed at all
}
@wire(invokeMuleService) 
getDropdownOptions({error,data}){
   if(data){
    this.defaultValues();
   }
}
@api async defaultValues(){
    console.log('recid',this.recordId); **//NEED RECORD ID HERE ANYHOW**
        await fetchExistingValues@wire(fetchExistingValues,{evalId'evalId':this.recordId'$recordId'}).then((result)=>{
            ifpreLoadValues(result{error,data}){
                ...//do some logic
            }
        })here
}

I have an lwc action button that loads the popup. When i load the component for first time, recordId is present. But when i close and open it again(without reloading the whole page), recordId is lost. Kindly advise

export default class EmeaSubmitEvalRequest extends LightningElement {
@api recordId;
constructor(){
    super();
    console.log('constrcu',this.recordId);//not printed at all
}
connectedCallback(){
    console.log('connected recid',this.recordId);//not printed at all
}
@wire(invokeMuleService) 
getDropdownOptions({error,data}){
   if(data){
    this.defaultValues();
   }
}
@api async defaultValues(){
    console.log('recid',this.recordId); **//NEED RECORD ID HERE ANYHOW**
        await fetchExistingValues({evalId:this.recordId}).then((result)=>{
            if(result){
                ... some logic
            }
        })
}

I have an lwc action button that loads the popup. When i load the component for first time, recordId is present. But when i close and open it again(without reloading the whole page), recordId is lost. Kindly advise

export default class EmeaSubmitEvalRequest extends LightningElement {
_recordId;

@api set recordId(value) {
    this._recordId = value;
    console.log('in setter',this._recordId);
}

get recordId() {
    return this._recordId;
}
constructor(){
    super();
    console.log('constrcu',this.recordId);//not printed at all
}
connectedCallback(){
    console.log('connected recid',this.recordId);//not printed at all
}
@wire(invokeMuleService) 
getDropdownOptions({error,data}){
   if(data){
    this.defaultValues();
   }
}


   @wire(fetchExistingValues,{'evalId':'$recordId'}) preLoadValues({error,data}){
//do some logic here
}
Source Link

recordId is blank in imperative call

I have an lwc action button that loads the popup. When i load the component for first time, recordId is present. But when i close and open it again(without reloading the whole page), recordId is lost. Kindly advise

export default class EmeaSubmitEvalRequest extends LightningElement {
@api recordId;
constructor(){
    super();
    console.log('constrcu',this.recordId);//not printed at all
}
connectedCallback(){
    console.log('connected recid',this.recordId);//not printed at all
}
@wire(invokeMuleService) 
getDropdownOptions({error,data}){
   if(data){
    this.defaultValues();
   }
}
@api async defaultValues(){
    console.log('recid',this.recordId); **//NEED RECORD ID HERE ANYHOW**
        await fetchExistingValues({evalId:this.recordId}).then((result)=>{
            if(result){
                ... some logic
            }
        })
}