• Abhijeet Kumar 1
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 2
    Replies
Hi I am Stuck With the Step 7 steps in the Aura component Superbadges.

Please find the required code as below:

Error:
Challenge Not yet complete... here's what's wrong:
AddBoatReviews isn't instantiated in BoatDetails.cmp. BoatDetails should instantiate AddBoatReview in the “Add Review” tab, passing boat data to the component.

Add Boat Review :
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    <aura:attribute name="boatReview" type="BoatReview__c" access="public"/>
    <aura:attribute name="boatReviewRecord" type="Object" access="public"/>
    <aura:attribute name="boat" type="Boat__c"/>
    <aura:attribute name="recordError" type="String" access="private"/>
    <aura:registerEvent name="BoatReviewAdded" type="c:BoatReviewAdded"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <force:recordData aura:id="service"
                      targetError="{!v.recordError}"
                      targetRecord="{!v.boatReviewRecord}"
                      targetFields="{!v.boatReview}"
                      fields="Id,Name,Comment__c,Boat__c"
                      recordUpdated="{!c.onRecordUpdated}"
                      />
    <lightning:layout multipleRows="true">
        <lightning:layoutItem size="12" padding="around-small">
            <lightning:input name="title" label="Title" value="{!v.boatReview.Name}"/>
        </lightning:layoutItem>
        
        <lightning:layoutItem size="12" padding="around-small">
            <label class="slds-form-element__label" for="input-id-01">Description</label>
            <lightning:inputRichText value="{!v.boatReview.Comment__c}" disabledCategories="FORMAT_FONT"/>
        </lightning:layoutItem>
        
        <lightning:layoutItem size="12" class="slds-align--absolute-center">
            <lightning:button iconName="utility:save" label="Submit" onclick="{!c.onSave}"/>
        </lightning:layoutItem>
    </lightning:layout>
    <aura:if isTrue="{!not(empty(v.recordError))}">
        <div class="recordError">
            <ui:message title="Error" severity="error" closable="true">
                {!v.recordError}
            </ui:message>
        </div>
    </aura:if>
</aura:component>

Controller:

({
    
    doInit : function(component,event,helper) {
        helper.onInit(component,event,helper);
    },
    
    onSave : function(component, event, helper) {
        component.find("service").saveRecord(function(saveResult) {
            if (saveResult.state === "SUCCESS" || saveResult.state === "DRAFT") {
                
                // record is saved successfully
                var resultsToast = $A.get("e.force:showToast");
                if(resultsToast) {
                    resultsToast.setParams({
                        "title": "Saved",
                        "message": "The record was saved."
                    });
                    resultsToast.fire();
                } else {
                    alert("The record was saved");
                }            
                var newBoatReviewAddedEvent = component.getEvent("BoatReviewAdded");
                newBoatReviewAddedEvent.fire();
                helper.onInit(component,event,helper);
            } else if (saveResult.state === "INCOMPLETE") {
                // handle the incomplete state
                console.log("User is offline, device doesn't support drafts.");
            } else if (saveResult.state === "ERROR") {
                // handle the error state
                console.log('Problem saving contact, error: ' + 
                            JSON.stringify(saveResult.error));
            } else {
                console.log('Unknown problem, state: ' + saveResult.state +
                            ', error: ' + JSON.stringify(saveResult.error));
            }
        });
        
        
    },
    
    onRecordUpdated : function (component, event , helper ) {
        var eventParams = event.getParams();
        if(eventParams.changeType === "CHANGED") {
            var resultsToast = $A.get("e.force:showToast");
            if(resultsToast) {
                resultsToast.setParams({
                    "title": "Saved",
                    "message": "The record was saved."
                });
                resultsToast.fire();
            } else {
                alert("The record was saved");
            }
        }
    }
})

Helper:

({
    onInit : function(component, event, helper) {
        // Prepare a new record from template
        component.find("service").getNewRecord(
            "BoatReview__c",
            null,
            false,
            $A.getCallback(function() {
                var rec = component.get("v.boatReview");
                var error = component.get("v.recordError");
                console.log('hey', JSON.stringify(rec));
                
                if (error || (rec === null)) {
                    console.log("Error initializing record template: " + error);
                } else {
                    rec.Boat__c = component.get("v.boat").Id;
                    component.set("v.boatReview.Boat__c",component.get("v.boat").Id);
                    console.log("Record template initialized: " + rec.sobjectType);
                }
            })
        );
    }
})

Boat Detais:
 
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    <aura:attribute name="selTabId" type="Id"/>
    <aura:attribute name="boat" type="Boat__c"/>
    <aura:attribute name="id" type="Id" />
    <aura:attribute name="recordError" type="String"/>
    <aura:handler event="c:BoatSelected" action="{!c.onBoatSelected}" />
    <aura:registerEvent name="BoatReviewAdded" type="c:BoatReviewAdded"/>
    <aura:handler name="BoatReviewAdded" event="c:BoatReviewAdded" action="{!c.onBoatReviewAdded}"/>
    <force:recordData aura:id="service"
                      layoutType="FULL"
                      recordId="{!v.id}"
                      fields="Id,Name,Description__c,Price__c,Length__c,Contact__r.Name,
                                  Contact__r.Email,Contact__r.HomePhone,BoatType__r.Name,Picture__c"
                      targetError="{!v.recordError}"
                      targetFields="{!v.boat}"
                      mode="EDIT"
                      recordUpdated="{!c.onRecordUpdated}"
                      />
    <aura:if isTrue="{!not(empty(v.id))}">
    <lightning:tabset variant="scoped" selectedTabId="{!v.selTabId}" aura:id="details">
            <lightning:tab label="Details" id="details" >
                 <c:BoatDetail boat="{!v.boat}"/>  
            </lightning:tab>
            <lightning:tab label="Reviews" id="boatreviewtab" >
               
            </lightning:tab>
            <lightning:tab label="Add Review" id="addReview" >
                <c:AddBoatReview boat="{!v.boat}"/>  
            </lightning:tab>
        </lightning:tabset>
    </aura:if>
    <aura:if isTrue="{!not(empty(v.recordError))}">
        <div class="recordError">
            <ui:message title="Error" severity="error" closable="true">
                {!v.recordError}
            </ui:message>
        </div>
    </aura:if>
</aura:component>

Controller
({
    onBoatSelected : function(component, event, helper) {
        var boatSelected=event.getParam("boat");
        component.set("v.id",boatSelected.Id);
        component.find("service").reloadRecord() ;
    },
    onRecordUpdated : function(component, event, helper) {
    },
    onBoatReviewAdded : function(component, event, helper) {
        console.log("Event received");
        component.set("v.selTabId", "boatreviewtab");
    }
})

​​​​​​​​​​​​​​
 
Hi req as follows:-
Custom Setting :  Vacancy_Media_Mapping
 Custom setting having four fields :- VacancyMedianode, Type, Area and Logo:
                                                  1st record:- client logo, LOGO, CientLOgo, client logo url      
                                                   2nd record :- job video, VIDEO, jobdescription, job video url
                                                   3rd record :- Client video, MOREINFORMATION ,cient vidoe url

And we have three check boxes in the object field as follows:-
                                               1.Client Logo flag
                                                2. Client video flag
                                               3.job video flag

Req: whenever user make the Client Logo flag as true then xml from the custom setting client logo url must be present in the xml file.
Please help to arrange the necessary condition
Code as below:
Map :- Map<String,  Vacancy_Media_Mapping__c> vacancyMediaMapping = Vacancy_Media_Mapping__c.getAll();
       List<String> vacancyMedia = new List<String>();
        for(String vmName : vacancyMediaMapping.keySet()){
            vacancyMedia.add(vmName);
        }

XML generation :-
if(vacancyMediaMapping.size()>0){
                            for(integer i=0;i<vacancyMediaMapping.size();i++){
                                if(objJob.Client_Logo_flag__c=true){
                                   xmlW.writeStartElement(null,'Path',null);
                                   xmlW.writeCharacters(vacancyMediaMapping.get(vacancyMedia[i]).Path__c);
                                   xmlW.writeEndElement();
                                }
Currently it is giving me all the three url, from above code i want to fetch only client logo url,..
Hi I want to create a Picklist in Visualforce Page where vaules are stored in the custom setting ? and the values which are there in custom setting are basiccaly ULR , Please let me know if this is possible??? 

name of the custom setting "URL Container"
In order to solve the bage "Use Events to Add Markers to the Map" i am getting following error//

Error : AccountList's JS controller does not get a reference to the 'AccountsLoaded' event


Please help me with suitable answer.
Hi req as follows:-
Custom Setting :  Vacancy_Media_Mapping
 Custom setting having four fields :- VacancyMedianode, Type, Area and Logo:
                                                  1st record:- client logo, LOGO, CientLOgo, client logo url      
                                                   2nd record :- job video, VIDEO, jobdescription, job video url
                                                   3rd record :- Client video, MOREINFORMATION ,cient vidoe url

And we have three check boxes in the object field as follows:-
                                               1.Client Logo flag
                                                2. Client video flag
                                               3.job video flag

Req: whenever user make the Client Logo flag as true then xml from the custom setting client logo url must be present in the xml file.
Please help to arrange the necessary condition
Code as below:
Map :- Map<String,  Vacancy_Media_Mapping__c> vacancyMediaMapping = Vacancy_Media_Mapping__c.getAll();
       List<String> vacancyMedia = new List<String>();
        for(String vmName : vacancyMediaMapping.keySet()){
            vacancyMedia.add(vmName);
        }

XML generation :-
if(vacancyMediaMapping.size()>0){
                            for(integer i=0;i<vacancyMediaMapping.size();i++){
                                if(objJob.Client_Logo_flag__c=true){
                                   xmlW.writeStartElement(null,'Path',null);
                                   xmlW.writeCharacters(vacancyMediaMapping.get(vacancyMedia[i]).Path__c);
                                   xmlW.writeEndElement();
                                }
Currently it is giving me all the three url, from above code i want to fetch only client logo url,..

I'm excited to announce that we've turned on some great new features for the discussion boards! The biggest new feature is the addition of Kudos. You may have noticed the new blue star that appears on posts right under the user's avatar. The number to the left of the star is how many kudos that post has received. If you want to give a user kudos for their post, just click the star and watch the number rise. The kudos count for an entire thread will show up in the message list so you can at a glance tell which threads are getting a lot of kudos. There's also a leaderboard for Top Kudoed Authors that you'll see on each category board as well as for overall board posts. This leaderboard spans a 30-day time frame so to stay at the top you'll have to be active in the community. Leaderboards are also available for Top Kudoed Posts and Top Kudo Givers. You can give out unlimited kudos, so don't be stingy! Kudos should highlight the quality posts on the boards. 

 

Another new feature is Search Before Post. Now as you go to create a new topic on the boards you'll notice a search drop down appearing as you type in a topic subject. The seach is looking for other topics that have similar words in the subject. This will help you locate any previous post that has already addressed your question, and you can go ahead and skip to the solution.

 

The final new feature is Quick Reply - which you'll see right below in this post! This will allow you to reply right from the post itself without having to navigate to another screen. Because this is a Quick Reply, you won't have the full WYSIWYG controls or be able to paste code; but it's great for quickly answering or asking a follow-up question.

 

I want to hear from you what you think of these new features and what else we can do to make the boards work best for you. There's some exciting stuff in the works, including a new ranking system, contests, and other fun stuff. This is your community; I want to hear from you!

 

Thanks,

April

anassi@salesforce.com