You need to sign in to do that
Don't have an account?
JohnDurai
Need help on refreshing Page on Lightning web component
I have Notes component placed on record page which will refer field, the coponent is getting refreshed in UI when we update something inside component but when i refresh the whole page then only it is getting updated on record page, I need to referesh record page as well on updating the component. I am aware that ther is somethingn called "Apedrefresh" can someone help me on this,
This is my wire method:
* -----------------------------------------
WIRE METHODS
----------------------------------------- */
@wire(getFieldInfo, { recordId: '$recordId', fieldName: '$fieldName' })
wiredFieldInfo({error, data}){
if(error){
this.processError(error);
} else if(data){
var fieldData = JSON.parse(JSON.stringify(data));
if(data.fieldDescribe){
fieldData.fieldDescribe = JSON.parse(data.fieldDescribe);
if(!this.modalTitle){
this.modalTitle = fieldData.fieldDescribe.label;
}
this.accessible = data.fieldAccess;
this.updateable= fieldData.fieldDescribe.updateable;
this.disabled = !(this.updateable);
this.fieldlength = fieldData.fieldDescribe.length;
}
if(data.fieldValue){
this.fieldValue = data.fieldValue;
this.iconName = FILLED_NOTE_ICON;
}
}
};
this is my save notes handler:
saveNotes(){
var context = this;
this.isLoading = true;
saveNotesInfo({recordId: this.recordId, fieldName: this.fieldName, fieldValue: this.fieldValue})
.then((result) => {
context.showSuccessToast('Success', context.modalTitle + ' successfully saved');
})
.catch((error) => {
context.processError(error);
})
.finally(() => {
context.isNotesModalOpen = false;
this.isLoading = false;
if (this.fieldValue === '') {
this.iconName = EMPTY_NOTE_ICON;
} else {
this.iconName=FILLED_NOTE_ICON;
}
});
}
This is my wire method:
* -----------------------------------------
WIRE METHODS
----------------------------------------- */
@wire(getFieldInfo, { recordId: '$recordId', fieldName: '$fieldName' })
wiredFieldInfo({error, data}){
if(error){
this.processError(error);
} else if(data){
var fieldData = JSON.parse(JSON.stringify(data));
if(data.fieldDescribe){
fieldData.fieldDescribe = JSON.parse(data.fieldDescribe);
if(!this.modalTitle){
this.modalTitle = fieldData.fieldDescribe.label;
}
this.accessible = data.fieldAccess;
this.updateable= fieldData.fieldDescribe.updateable;
this.disabled = !(this.updateable);
this.fieldlength = fieldData.fieldDescribe.length;
}
if(data.fieldValue){
this.fieldValue = data.fieldValue;
this.iconName = FILLED_NOTE_ICON;
}
}
};
this is my save notes handler:
saveNotes(){
var context = this;
this.isLoading = true;
saveNotesInfo({recordId: this.recordId, fieldName: this.fieldName, fieldValue: this.fieldValue})
.then((result) => {
context.showSuccessToast('Success', context.modalTitle + ' successfully saved');
})
.catch((error) => {
context.processError(error);
})
.finally(() => {
context.isNotesModalOpen = false;
this.isLoading = false;
if (this.fieldValue === '') {
this.iconName = EMPTY_NOTE_ICON;
} else {
this.iconName=FILLED_NOTE_ICON;
}
});
}
Try The Following Code
I've Made Some Changes Please Mark it As Best if it Helps
Thank You!
All Answers
Try The Following Code
I've Made Some Changes Please Mark it As Best if it Helps
Thank You!