You need to sign in to do that
Don't have an account?
Victor Verma
lwc superbadge 8 issue
Challenge Not yet complete... here's what's wrong:
We can’t find the correct settings for the method handleSave() in the component boatSearchResults JavaScript file. Make sure the method was created according to the requirements, using the correct event, refresh method, correct promises, toast events for success and failure using the constants, and complete error handling.
We can’t find the correct settings for the method handleSave() in the component boatSearchResults JavaScript file. Make sure the method was created according to the requirements, using the correct event, refresh method, correct promises, toast events for success and failure using the constants, and complete error handling.
handleSave(event) { const recordInputs = event.detail.draftValues.slice().map(draft => { const fields = Object.assign({}, draft); return { fields }; }); const promises = recordInputs.map(recordInput => { return updateRecord(recordInput); }); Promise.all(promises) .then(() => { this.dispatchEvent( new ShowToastEvent({ title: SUCCESS_TITLE, message: SUCCESS_MSG, variant: 'success', }) ); this.draftValues = []; this.refresh(); }) .catch(error => { this.dispatchEvent( new ShowToastEvent({ title: ERROR_TITLE, message: error.message.body, variant: 'error', }) ); }); }
We have a separate Trailhead team who can help you with these issues. So, can you please use the below link to reach out to them so that one of the agent will get in touch with you.
Support:https://trailhead.salesforce.com/help
Thank you!
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Thanks,
Vinay Kumar
Please refer the below code:
The handle Save method should be like below:
handleSave:
Refresh Method:
Thanks,
Maharajan.C
async handleSave(event) {
const updatedFields = event.detail.draftValues;
await updateBoatList({data: updatedFields })
.then(() => {
this.dispatchEvent(
new ShowToastEvent({
title: SUCCESS_TITLE,
message: MESSAGE_SHIP_IT,
variant: SUCCESS_VARIANT
})
);
getRecordNotifyChange([{boatTypeId: this.boatTypeId}]);
// Display fresh data in the form
this.draftValues = [];
this.refresh();
})
.catch(error => {
this.dispatchEvent(
new ShowToastEvent({
title: ERROR_TITLE,
message: error.body.message,
variant: ERROR_VARIANT
})
);
})
.finally(() => {
this.draftValues = [];
}
);
}