3

I can't to complete challenge "Get Hands-On with New Alert, Confirm, and Prompt Modules and Components". I'm pretty sure this challenge have a bug and I want to know I made a mistake or this is challenge have bug.

The assignment:

import { LightningElement, api } from "lwc";
export default
class recordCardQuickFiles extends LightningElement {
 @api
 recordId;
 onDeleteAllFilesButtonClick() {
  const confirmation = confirm("Are you sure you want to delete all files?");
   if (confirmation) {
      //... proceed with
     //... Apex Logic to delete Files.
    //... We will not check this comment.
    }
  }
}
  • Create a new Lightning Web component
  • Name: recordCardQuickFiles
  • Import LightningConfirm from "lightning/confirm"
  • Replace the confirm method with the LightningConfirm method
  • Message: "Are you sure you want to delete all files?"
  • Variant: "headerless"
  • Label: "Are you sure you want to delete all files?"

My solution:

import { LightningElement, api } from "lwc";
import LightningConfirm from "lightning/confirm";
export default
class recordCardQuickFiles extends LightningElement {
    @api
    recordId;
    configs = {
        Message: "Are you sure you want to delete all files?",
        Label: "Are you sure you want to delete all files?",
        Variant: "headerless"
    }
    onDeleteAllFilesButtonClick() {
        const confirmation = LightningConfirm.open(this.configs);
        if (confirmation) {
            //... proceed with
            //... Apex Logic to delete Files.
            //... We will not check this comment.
        }
    }
}

And error occured: Challenge not yet complete in your.org The Message used in the LightningConfirm method is not correct.

  • 1
    You are new here. Stackoverflow is a manual to search info clear doubt. When you place your lesson looks like you want someone to do your job. This is not cool. Just a tip, think someone will be help with my exclusive lesson solved? – Aloiso Junior Sep 09 '22 at 07:59
  • @AloisoJunior hi, it isn't my job task. I need complete this challenge that continue JS certification. But I'm pretty sure this challenge have a bug and I want to know I make a mistake or this is challenge bug. – Vladyslav Palamarchuk Sep 09 '22 at 08:15

1 Answers1

5

The JS file for the LWC should be something like the following:

import { LightningElement, api } from "lwc";
import LightningConfirm from 'lightning/confirm';

export default
class recordCardQuickFiles extends LightningElement {
    @api
    recordId;
    onDeleteAllFilesButtonClick() {
        const confirmation = LightningConfirm.open({
            Message: 'Are you sure you want to delete all files?',
            Variant: 'headerless',
            Label: 'Are you sure you want to delete all files?'
        });
        if (confirmation) {
            //... proceed with
            //... Apex Logic to delete Files.
            //... We will not check this comment.
        }
    }
}

I hope that helps. Thanks!

Gerardo Lima
  • 6,467
  • 3
  • 31
  • 47