+ Start a Discussion
Biswajit SamantarayBiswajit Samantaray 

Aura component superbadge challenge 8 Action failed: c:BoatDetails$controller$onRecordUpdated [refreshBoatReviews is undefined]

Biswajit SamantarayBiswajit Samantaray

Maybe, here is what you are doing wrong:
You are not going for the truthy/falsy checking in the Javascript which is very important at all times>>>

I don't know right now why we get undefined when we use the find method for <c:BoatReviews> right now - maybe has to do something with renderinf life cycle.And we can't use any methods on undefined object. But here is what I did and it solved the problem:
At BoatDetails.cmp side:
........
<lightning:tab label="Reviews" id="boatreviewtab">
            <c:BoatReviews boat="{!v.boat}" aura:id="refreshBoatReviews"/>
        </lightning:tab>
........
At BoatDetailsController.js side:
......
onRecordUpdated : function(component,event,helper){
        let refreshBoatReviews = component.find("refreshBoatReviews");
       // Here I learned the importance of always checking
       // for truthy and falsy statements. If you donot, then you get undefined or some errors
        if(refreshBoatReviews){
        refreshBoatReviews.refresh();
        }
    },
    
    onBoatReviewAdded : function(component,event,helper){
        //  component.set("v.changeTabFocus","boatreviewtab");
        //  Fifth subunit challenge in Aura components basics
        component.find("changeTabFocus").set("v.selectedTabId", "boatreviewtab");
        
//Were not getting errors on doing truthy/falsy checking error here but better develop the practice than being sorry
        let refreshBoatReviews = component.find("refreshBoatReviews");
        if(refreshBoatReviews){
            refreshBoatReviews.refresh();
        }
    }
........

Now this will work exactly as per the business scenario.;)

Biswajit SamantarayBiswajit Samantaray
Guess after the BoatDetails.cmp initialization is complete once, we dont get undefined when we use component.find("refreshBoatReviews").
Biswajit SamantarayBiswajit Samantaray

Next if you have confusion on the data-userid of the challenge then I would like you to look up for it up in google in the W3schools.com website's following link to get and idea what these things are like:

https://www.w3schools.com/tags/att_global_data.asp

Its something different that we will get to learn by observing what is there to be taught

AbhishekAbhishek (Salesforce Developers) 
Hi,

For all the Certification and Trailhead Guidance please report it here,

https://trailhead.salesforce.com/en/help?support=home

https://trailhead.salesforce.com/help

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

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Regards,
Salesforce Support.