• Victor Verma
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
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.
 
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',
                })
            );
        });
}