• Cameron Ames
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
I'm tearing my hair out trying to figure out why I'm not passing step 12 of the LWC Specialist superbadge. The error I'm receiving is:

"We can’t find the correct settings for navigateToRecord() in the component boatReviews controller. Make sure the component was created according to the requirements, navigating to the standard record page, based on record Id, in view mode, using the proper case-sensitivity and quotation."

My code consists of the following:
 
<a data-record-id={boatReview.CreatedBy.Id} title={boatReview.CreatedBy.Name} onclick={navigateToRecord}>{boatReview.CreatedBy.Name}</a>
 
// Helper method to use NavigationMixin to navigate to a given record on click
    navigateToRecord(event) {
      const recordId = event.target.getAttribute("data-record-id");    //have tried with and without this line
      event.preventDefault();                                          //have tried with and without this line
      event.stopPropagation();                                         //have tried with and without this line
      this[NavigationMixin.Navigate]({
          type: "standard__recordPage",
          attributes: {
              recordId: recordId,                                      //have tried directly calling event.target.getAttribute instead of referencing a variable
              actionName: "view"
          }
      });
    }

Some other things I have tried include switching between single/double quotes, exposing the method as public (thinking maybe they needed to instantiate/test it for some reason), and more. The navigation WORKS - nothing is wrong with this from a functional perspective, which is what makes this so frustrating. Any ideas?