I am calling LWC from Aura Component on Quick Action.I have to open my LWC open as a tab. for that I have used this method in my Aura Component . Now I am able to open LWC component but in the sames tab.I want to know that how to get the recordId in my LWC.
/* eslint-disable no-alert */
/* eslint-disable no-console */
import { LightningElement, api, track, wire } from 'lwc';
import getOppty from '@salesforce/apex/FeedbackCtrl.getOppty';
import { handleErrors, showToast } from 'c/girikonUtil';
import { createRecord } from 'lightning/uiRecordApi';
import { CurrentPageReference } from 'lightning/navigation';
import saveRefereeFeedback from '@salesforce/apex/FeedbackCtrl.refereeFeedback';
export default class RefereeFeedback extends LightningElement {
@track agencyName;
@track agentName;
@track applicationDate;
@track ecaContactOfficer;
@track oppId;
@track conParam;
@track ownerId;
connectedCallback(){
let newURL = new URL(window.location.href).searchParams;
this.oppId=newURL.get('opp');
console.log('===oppId=='+this.oppId);
this.conParam=newURL.get('con');
console.log('===conId=='+this.conParam);
getOppty({
oppId: this.oppId
}).then(response => {
console.log('==36=='+JSON.stringify(response));
const objData = JSON.parse(JSON.stringify(response));
this.agencyName = objData[0].Account.Name;
this.ecaContactOfficer=objData[0].Owner.Name;
this.applicationDate =objData[0].CreatedDate;
this.agentName = objData[0].Account.hed__Primary_Contact__r.Name;
this.ownerId = objData[0].OwnerId;
console.log('==agencyName=='+JSON.stringify(objData[0].Account.Name));
console.log('==ecaContactOfficer=='+JSON.stringify(objData[0].Owner.Name));
console.log('==applicationDate=='+JSON.stringify(objData[0].CreatedDate));
console.log('==agentName=='+JSON.stringify(objData[0].Account.hed__Primary_Contact__r.Name));
}).catch(error => {
console.log('Errors ', error.body.message);
})
}
saveForm(event)
{
this.isFormInProgress = true;
this.template.querySelector(".submit").click();
}
handleSubmit(event)
{
event.preventDefault();
const fields = event.detail.fields;
fields.Referee_Name__c = this.conParam;
fields.Date_Of_Application__c = this.applicationDate;
fields.ECA_Contact_Officer__c = this.ownerId;
saveRefereeFeedback({Data:fields})
.then(response =>{
showToast(this, 'Thanks! your Feedback has been submitted successfully.', 'success', 'success');
}).catch(error => {
})
}
cancel(){
window.close();
return false;
}
}