You need to sign in to do that
Don't have an account?
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:
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?
"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?
For all the Trailhead issues please report it here,
https://trailhead.salesforce.com/help?support=home#
https://trailhead.salesforce.com/help
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.
Regards,
Salesforce Support.
I _think_ you need this;
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,