function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sandip ChakrabortySandip Chakraborty 

aura component specialist challenge 7 does not shift focus to Reviews Tab even though I did everything correct and I passed the challenge

I need a help here. Though I have passed the challenge 7 , but my review Tab is not getting focus. However the event is fired and captured by the parent component but it is not chaning the tab. I have tried in google chrome and edge. Here is my code. Any help is appreciated.

Boat Detais - 
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" >
    <aura:attribute name="id" type="Id" />
    <aura:attribute name="boat" type="Boat__c" />
    <aura:attribute name="selectedTabId" type="String"/>
    <aura:handler event="c:BoatSelected" action="{!c.onBoatSelected}"/>
    <aura:handler name="boatReviewAdded" event="c:BoatReviewAdded" action="{!c.onBoatReviewAdded}" />
    <aura:if isTrue="{! !empty(v.boat)}">
        <lightning:tabset variant="scoped" aura:id="tabs" selectedTabId="{!v.selectedTabId}">
            <lightning:tab label="Details" aura:id="boatdetailstab">
                <c:BoatDetail boat="{!v.boat}"/>
            </lightning:tab>
            <lightning:tab label="Reviews" aura:id="boatreviewtab">
                This is review tab !!
            </lightning:tab>
            <lightning:tab label="Add Review" aura:id="addreviewtab">
                <c:AddBoatReview boat="{!v.boat}"/>
            </lightning:tab>
        </lightning:tabset>
    </aura:if>
    <force:recordData aura:id="service"
        recordId="{!v.id}"
        targetFields="{!v.boat}"
        fields="Id, Name, Description__c,Price__c,Length__c,
            Contact__r.Name,Contact__r.Email,Contact__r.HomePhone,BoatType__r.Name,Picture__c"
        mode="VIEW"
        recordUpdated="{!c.onRecordUpdated}"
    />
</aura:component>
BoatDetailsController :
({
    onBoatSelected : function(component, event, helper) {
        console.log('Method from Boat Details..');
        var boat = event.getParam("boat");
        console.log('Boat Id..'+boat.Id);
        component.set("v.id" , boat.Id);
        var recordData = component.find("service");
        recordData.reloadRecord();
        
    },
    onBoatReviewAdded : function (component, event, helper){
        console.log("Review tab event listen..");
// I tried below both option. not any luck.
        component.set("v.selectedTabId","boatreviewtab");
        //component.find("tabs").set("v.selectedTabId","boatreviewtab");

    },
    onRecordUpdated : function (component, event, helper)
    {
        var recordData = component.find("service");
        recordData.reloadRecord();
    }
})

BoatReviewAdded :
<aura:event type="COMPONENT" description="Event template">
    <aura:attribute name="boat" type="Boat__c" /> // I Added this attribute as an option if that solves my problem. But no luck.
</aura:event>

AddBoatReview.cmp
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="global">
    <aura:attribute name="boat" type="Boat__c"/>
    <aura:attribute name="boatReview" type="BoatReview__c"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:registerEvent name="boatReviewAdded" type="c:BoatReviewAdded" />
    <aura:attribute name="recordError" type="String" access="private"/>
    
    <force:recordData aura:id="service"
        targetFields="{!v.boatReview}"
        targetError="{!v.recordError}"
        fields="Id,Name,Comment__c,Boat__c"
        recordUpdated="{!c.onRecordUpdated}"
    />
    <div class="slds-form slds-form-element-stacked">
        <lightning:input aura:id="title" name="title" label="Title" value="{!v.boatReview.Name}" required="true"/> 
        <lightning:inputRichText aura:id="comment" labelVisible="true" label="Description:"   disabledCategories="FORMAT_FONT" placeholder="Comment" value="{!v.boatReview.Comment__c}"/> 
        <lightning:button iconName="utility:save" label="Save" onclick="{!c.onSave}" class="slds-align_absolute-center"/>
    </div>
    <aura:if isTrue="{!not(empty(v.recordError))}">
        <div class="recordError">
            {!v.recordError}
        </div>
    </aura:if>
</aura:component>

AddBoatReview controller
({
    doInit : function(component, event, helper) {
        helper.onInit(component, event, helper);
    },
    onSave : function(component, event, helper){
        component.find("service").saveRecord($A.getCallback(function(saveResult){
            if(saveResult.state == "SUCCESS" ||saveResult.state == "DRAFT"){
                
                var toastEvt = $A.get("e.force:showToast");
                if(toastEvt){
                    toastEvt.setParams({
                        "title":"Success !!",
                        "message" :"Record Created Successfully"
                    });
                    toastEvt.fire();
                }
                else{
                    alert("Record Created Successfully");
                }
                helper.onInit(component, event, helper);
                component.getEvent("boatReviewAdded").fire();
                
            }
            else if(saveResult.state == "ERROR"){
                
            } 

        }));
    },
    onRecordUpdated : function (component,event,helper){
        var changeType = event.getParams().changeType;
        /*
        if (changeType === "ERROR") {}
        else if (changeType === "LOADED") {}
        else if (changeType === "REMOVED") {}
        else if (changeType === "CHANGED") {}
        */
        if(changeType === "CHANGED"){
            var toastEvt = $A.get("e.force:showToast");
            if(toastEvt){
                toastEvt.setParams({
                    "title":"Success !!",
                    "message" :"Record Changed Successfully"
                });
                toastEvt.fire();
            }
            else{
                alert("Record Changed Successfully");
            }
        }
    }
})

 
ANUTEJANUTEJ (Salesforce Developers) 
Hi Sandip,

Greetings!

There is a separate Trailhead team who can help you with these issues.So,can you please use the below link to reach out to them so that one of the agent will get in touch with you.

Support:https://trailhead.salesforce.com/help

Thank 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.

Warm Regards,
Anutej.