+ Start a Discussion
Cameron AmesCameron Ames 

LWC Specialist Step 12 Navigation Mixin Problem

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
          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?
AbhishekAbhishek (Salesforce Developers) 

For all the Trailhead issues please report it here,



So that our trailhead support engineers will look into it and get back to you.

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

​​​​​​​Salesforce Support.
Todd Halfpenny MCTodd Halfpenny MC

I _think_ you need this;

recordId: event.target.dataset.recordId
I believe the `event.target.getAttribute` also works, but I believe that the challenge-checker does not like this.
For info I'm not at the point yet... it's just I had seen another post on this somewhere,
Himaja ChanumoluHimaja Chanumolu
Try the below code. It worked for me. try with event.target.dataset.recordId
navigateToRecord(event) {
            type: 'standard__recordPage',
            attributes: {
                recordId: event.target.dataset.recordId,
                actionName: 'view',