• Abhishek-tandon
  • NEWBIE
  • 85 Points
  • Member since 2017

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 29
    Replies
I have an elegant working save() method for step 3:
 
public PageReference save(){
    	SavePoint savePoint = this.databaseHelper.setSavePoint();
    	Map<PriceBookEntry, Product2> productByPriceBookEntryMap = this.buildProductByPriceBookEntryMap();
    	
    	String errorMessage = this.saveProductList(productByPriceBookEntryMap.values());
    	if (String.isBlank(errorMessage)) {
    		errorMessage = this.savePriceBookEntryList(productByPriceBookEntryMap);
    	}

    	if (!String.isBlank(errorMessage)) {
    		this.databaseHelper.rollback(savePoint);
    		visualForceHelper.addErrorMessage(Constants.ERROR_MESSAGE + errorMessage);
    	} else {
    		resetForm();
    	}
    	
        return null;
    }

But, of course this won't work because Trailhead tests implementation details rather than results.

(For the love for all that is holy or unholy or completely irrelevant to holiness, can somebody please teach the trailhead challenge developers  how to write good tests and stop checking my implementation details?)

So, now I am trying to turn this into something Trailhead will recognize instead of telling me:
 
Challenge Not yet complete... here's what's wrong: 
Ensure that the save method inserts only Products and Pricebooks for rows that have all fields populated.

Now, my save() method is looking like this:
 
public PageReference save(){
    	SavePoint savePoint = Database.setSavePoint();
    	Map<PriceBookEntry, Product2> productByPriceBookEntryMap = new Map<PriceBookEntry, Product2>();
    	for (ProductWrapper productWrapper : this.productsToInsert) {
    		if (
    			productWrapper.productRecord.Name != null && productWrapper.productRecord.Name != ''
				&& productWrapper.productRecord.Family != null && productWrapper.productRecord.Family != ''
				&& (productWrapper.productRecord.Family != Constants.SELECT_ONE)
				&& productWrapper.productRecord.Initial_Inventory__c != null && productWrapper.productRecord.Initial_Inventory__c > 0
				&& productWrapper.productRecord.IsActive
	
				&& productWrapper.priceBookEntryRecord.UnitPrice != null && productWrapper.priceBookEntryRecord.UnitPrice > 0
			) {
    			productByPriceBookEntryMap.put(productWrapper.pricebookEntryRecord, productWrapper.productRecord);
    		}
    	}
    	
    	String errorMessage;
    	try {
	    	errorMessage = this.saveProductList(productByPriceBookEntryMap.values());
	    	if (String.isBlank(errorMessage)) {
	    		errorMessage = this.savePriceBookEntryList(productByPriceBookEntryMap);
	    	}
	    	if (!String.isBlank(errorMessage)) {
	    		throw new Product2ExtensionException(errorMessage);
    		}
    		resetForm();
    	}
    	catch (Exception ex) {
    		Database.rollback(savePoint);
    		visualForceHelper.addErrorMessage(Constants.ERROR_MESSAGE + errorMessage);
    	}
        return null;
    }

This is advanced in all the ways of a five year old who doesn't know when to start new paragraphs or even divide sentences.
If I had a senior developer give me this code, I'd move to have him fired immediately.
But yet, I'm sure it will need to become much worse before I can pass this step.

It works, but doesn't pass.

Please tell me what cockimanie details are probably being badly described by this error.

 
Hi i am getting an error while completing the challenge 9 on the superbatch, even though my funtionality is working fine.

Error: 
Challenge Not yet complete... here's what's wrong: 
The BoatReviews component doesn't invoke the FiveStarRating component and bind the value to the Rating__c field of the BoatReview custom object.

BoatReviews.cmp
<aura:component controller="BoatReviews">
	<aura:attribute name="boat" type="Boat__c" access="public"/>
    <aura:attribute name="boatReviews" type="BoatReview__c[]" access="private"/>
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    <aura:handler name="change" value="{!v.boat}" action="{!c.doInit}"/>
     <aura:method name="refresh" action="{!c.doInit}"> 
     </aura:method>
    
    <aura:if isTrue="{!v.boatReviews.length==0}">
    	<lightning:layoutItem class="slds-align_absolute-center" flexibility="auto" padding="around-small">   
              <ui:outputText value="No reviews available" />
        </lightning:layoutItem>
    </aura:if>
  <div class="slds-feed">
	<ul class="slds-feed__list">
         <ui:scrollerWrapper class="scrollerSize">
       <aura:iteration items="{!v.boatReviews}" var="review">
          
		<li class="slds-feed__item slds-scrollable_y">    
    		<article class="slds-post">
            	<header class="slds-post__header slds-media">
                <div class="slds-media__figure">
                    <a href="javascript:void(0);" class="slds-avatar slds-avatar_circle slds-avatar_large">
                        <img alt="{!review.CreatedBy.Name}" src="{!review.CreatedBy.SmallPhotoUrl}" title="{!review.CreatedBy.Name}"  />
                    </a>
                </div>
                <div class="slds-media__body">
                        <div class="slds-grid slds-grid_align-spread slds-has-flexi-truncate">
                            <p><a data-userid="{!review.CreatedBy.Id}" href="javascript:void(0);" title="{!review.CreatedBy.Name}" onclick="{!c.onUserInfoClick}">
                                {!review.CreatedBy.Name}
                                </a> 
                                — {!review.CreatedBy.CompanyName}
                            </p>
                        </div>
                    	<p class="slds-text-body_small">
                            <lightning:formattedDateTime value="{!review.LastModifiedDate}" year="numeric" month="short" day="numeric"  hour="2-digit" minute="2-digit" second="2-digit" />
                    	</p>
                    </div>
            </header>
             <div class="slds-post__content slds-text-longform">
                 <p class="slds-text-title_caps">{!review.Name}</p>
                 
                 <p class="slds-text-body_small"><lightning:formattedRichText value="{!review.Comment__c}"/> </p>
			</div>
             <footer class="slds-post__footer">
	<ul class="slds-post__footer-actions-list slds-list_horizontal">
		<li class="slds-col slds-item slds-m-right_medium">
			<c:FiveStarRating value="{!review.Rating__c}" readonly="true"/>
		</li>
		
	</ul>
                 
</footer>
    		</article>
          </li>
          
        </aura:iteration>
              </ui:scrollerWrapper>
    </ul>
  </div>
</aura:component>

Seems some problem with the lightning markup or CSS, any help will be appritiated 
HI All,

I am facing an issue with step 3 of the superbatch and getting the below error
Error

I tried multiple options in the component code.but none of them worked here
Option1 
<aura:attribute name="boat" type="Boat__c" />
<ul class="slds-has-dividers--bottom-space">
        <li class="slds-item  slds-float_left">
     <lightning:tile class="tile ">
        
             <lightning:button aura:id="{!v.boat.Id}" name="{!v.boat.Name}" class="tile">
                 <div style="{!'background-image:URL(\'https://resourceful-badger-249681-dev-ed.my.salesforce.com'+v.boat.Picture__c+'\')'}" class="innertile">
                 	
                      <div class="lower-third">
                			<h1 class="slds-truncate">{!v.boat.Contact__r.Name}</h1>
              			</div>
                 </div>
            </lightning:button>
         
            
    </lightning:tile>
         </li>
    </ul>
Option 2
<aura:attribute name="boat" type="Boat__c" />
<ul class="slds-has-dividers--bottom-space">
        <li class="slds-item  slds-float_left">
     
        
             <lightning:button aura:id="{!v.boat.Id}" name="{!v.boat.Name}" class="tile">
                 <div style="{!'background-image:URL(\'https://resourceful-badger-249681-dev-ed.my.salesforce.com'+v.boat.Picture__c+'\')'}" class="innertile">
                 	
                      <div class="lower-third">
                			<h1 class="slds-truncate">{!v.boat.Contact__r.Name}</h1>
              			</div>
                 </div>
            </lightning:button>
         
            

         </li>
    </ul>
Option 3
<aura:attribute name="boat" type="Boat__c" />
   <lightning:tile class="slds-tile--board">
     <lightning:button class="tile">
        <div style="{!'background-image:URL(\'https://resourceful-badger-249681-dev-ed.my.salesforce.com'+v.boat.Picture__c+'\')'}" class="innertile">
          <div class="lower-third">
           <h1 class="slds-truncate">{!v.boat.Contact__r.Name}</h1>
          </div>
        </div>
    </lightning:button>
    </lightning:tile>


 
Hi all,

I'm getting an error while verifying step 7:
  • Challenge Not yet complete... here's what's wrong:  Ensure that you implement all the pagination methods using the corresponding StandardSetController methods.
I implemented the class using the StandardSetController methods but it doesn't work.

Any advice or suggestion?
Thank you.
Hi All,

While working on the Advanced Apex Specialist Superbadge Step 7 I am facing a weird issue.
User-added image

The OrderExtension class is alreeady containing a variable of StandardSetController and in the OrderEdit page orderItemList is getting iterated.
But Salesforce doesn't support standardsetcontroller for OrderItem.

Hence getting the error: List controllers are not supported for OrderItem

Could anyone please help me, how to solve this issue.

Thanks,
I have an elegant working save() method for step 3:
 
public PageReference save(){
    	SavePoint savePoint = this.databaseHelper.setSavePoint();
    	Map<PriceBookEntry, Product2> productByPriceBookEntryMap = this.buildProductByPriceBookEntryMap();
    	
    	String errorMessage = this.saveProductList(productByPriceBookEntryMap.values());
    	if (String.isBlank(errorMessage)) {
    		errorMessage = this.savePriceBookEntryList(productByPriceBookEntryMap);
    	}

    	if (!String.isBlank(errorMessage)) {
    		this.databaseHelper.rollback(savePoint);
    		visualForceHelper.addErrorMessage(Constants.ERROR_MESSAGE + errorMessage);
    	} else {
    		resetForm();
    	}
    	
        return null;
    }

But, of course this won't work because Trailhead tests implementation details rather than results.

(For the love for all that is holy or unholy or completely irrelevant to holiness, can somebody please teach the trailhead challenge developers  how to write good tests and stop checking my implementation details?)

So, now I am trying to turn this into something Trailhead will recognize instead of telling me:
 
Challenge Not yet complete... here's what's wrong: 
Ensure that the save method inserts only Products and Pricebooks for rows that have all fields populated.

Now, my save() method is looking like this:
 
public PageReference save(){
    	SavePoint savePoint = Database.setSavePoint();
    	Map<PriceBookEntry, Product2> productByPriceBookEntryMap = new Map<PriceBookEntry, Product2>();
    	for (ProductWrapper productWrapper : this.productsToInsert) {
    		if (
    			productWrapper.productRecord.Name != null && productWrapper.productRecord.Name != ''
				&& productWrapper.productRecord.Family != null && productWrapper.productRecord.Family != ''
				&& (productWrapper.productRecord.Family != Constants.SELECT_ONE)
				&& productWrapper.productRecord.Initial_Inventory__c != null && productWrapper.productRecord.Initial_Inventory__c > 0
				&& productWrapper.productRecord.IsActive
	
				&& productWrapper.priceBookEntryRecord.UnitPrice != null && productWrapper.priceBookEntryRecord.UnitPrice > 0
			) {
    			productByPriceBookEntryMap.put(productWrapper.pricebookEntryRecord, productWrapper.productRecord);
    		}
    	}
    	
    	String errorMessage;
    	try {
	    	errorMessage = this.saveProductList(productByPriceBookEntryMap.values());
	    	if (String.isBlank(errorMessage)) {
	    		errorMessage = this.savePriceBookEntryList(productByPriceBookEntryMap);
	    	}
	    	if (!String.isBlank(errorMessage)) {
	    		throw new Product2ExtensionException(errorMessage);
    		}
    		resetForm();
    	}
    	catch (Exception ex) {
    		Database.rollback(savePoint);
    		visualForceHelper.addErrorMessage(Constants.ERROR_MESSAGE + errorMessage);
    	}
        return null;
    }

This is advanced in all the ways of a five year old who doesn't know when to start new paragraphs or even divide sentences.
If I had a senior developer give me this code, I'd move to have him fired immediately.
But yet, I'm sure it will need to become much worse before I can pass this step.

It works, but doesn't pass.

Please tell me what cockimanie details are probably being badly described by this error.

 
Hey everyone, 
I keep getting this error in Step 5.

Challenge Not yet complete... here's what's wrong: 
We couldn't find the appropriate CSS for the BoatTile component. Be sure to include it in its own file, rather than inline.

I've tried many different ways and even tried using the CSS as an external resource.


 
Hi i am getting an error while completing the challenge 9 on the superbatch, even though my funtionality is working fine.

Error: 
Challenge Not yet complete... here's what's wrong: 
The BoatReviews component doesn't invoke the FiveStarRating component and bind the value to the Rating__c field of the BoatReview custom object.

BoatReviews.cmp
<aura:component controller="BoatReviews">
	<aura:attribute name="boat" type="Boat__c" access="public"/>
    <aura:attribute name="boatReviews" type="BoatReview__c[]" access="private"/>
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    <aura:handler name="change" value="{!v.boat}" action="{!c.doInit}"/>
     <aura:method name="refresh" action="{!c.doInit}"> 
     </aura:method>
    
    <aura:if isTrue="{!v.boatReviews.length==0}">
    	<lightning:layoutItem class="slds-align_absolute-center" flexibility="auto" padding="around-small">   
              <ui:outputText value="No reviews available" />
        </lightning:layoutItem>
    </aura:if>
  <div class="slds-feed">
	<ul class="slds-feed__list">
         <ui:scrollerWrapper class="scrollerSize">
       <aura:iteration items="{!v.boatReviews}" var="review">
          
		<li class="slds-feed__item slds-scrollable_y">    
    		<article class="slds-post">
            	<header class="slds-post__header slds-media">
                <div class="slds-media__figure">
                    <a href="javascript:void(0);" class="slds-avatar slds-avatar_circle slds-avatar_large">
                        <img alt="{!review.CreatedBy.Name}" src="{!review.CreatedBy.SmallPhotoUrl}" title="{!review.CreatedBy.Name}"  />
                    </a>
                </div>
                <div class="slds-media__body">
                        <div class="slds-grid slds-grid_align-spread slds-has-flexi-truncate">
                            <p><a data-userid="{!review.CreatedBy.Id}" href="javascript:void(0);" title="{!review.CreatedBy.Name}" onclick="{!c.onUserInfoClick}">
                                {!review.CreatedBy.Name}
                                </a> 
                                — {!review.CreatedBy.CompanyName}
                            </p>
                        </div>
                    	<p class="slds-text-body_small">
                            <lightning:formattedDateTime value="{!review.LastModifiedDate}" year="numeric" month="short" day="numeric"  hour="2-digit" minute="2-digit" second="2-digit" />
                    	</p>
                    </div>
            </header>
             <div class="slds-post__content slds-text-longform">
                 <p class="slds-text-title_caps">{!review.Name}</p>
                 
                 <p class="slds-text-body_small"><lightning:formattedRichText value="{!review.Comment__c}"/> </p>
			</div>
             <footer class="slds-post__footer">
	<ul class="slds-post__footer-actions-list slds-list_horizontal">
		<li class="slds-col slds-item slds-m-right_medium">
			<c:FiveStarRating value="{!review.Rating__c}" readonly="true"/>
		</li>
		
	</ul>
                 
</footer>
    		</article>
          </li>
          
        </aura:iteration>
              </ui:scrollerWrapper>
    </ul>
  </div>
</aura:component>

Seems some problem with the lightning markup or CSS, any help will be appritiated 
Hi All,

I am getting below error while checking the challenge for Lightning Component Framework Specialist at step 6

Challenge Not yet complete... here's what's wrong: 
The BoatSelected event isn't configured correctly. There is something missing or improperly configured in the BoatSelected.evt file.

Please help
I'm not clear why they're instructing us to package up the BoatTypeId as a property of an object called formData. Why not just pass the BoatTypeId directly?  Here's what it says:
 
Use a new event c:FormSubmit named formsubmit with an Object attribute named formData to pass the selected boatTypeId—as a property of formData—from BoatSearchForm to its parent component BoatSearch. Do this via a controller function called onFormSubmit() attached to the Search button.
In the 
BoatSearch component, handle FormSubmit with a controller action named onFormSubmit. Pass formData.boatTypeId from the controller to a public method on the BoatSearchResults component called search.
 
Why not just do this:
onFormSubmit : function(component, event, helper){
        var boatTypeId = component.get("v.selectedType");
        console.log("Search button pressed " + boatTypeId);
        var formSubmit = component.getEvent("formsubmit");
        formSubmit.setParams({"boatTypeId": boatTypeId});
        formSubmit.fire();
    },

 

Hello all,

I'm currently working through Step 7 of the new "Lightning Component Framework Specialist" superbadge, and I'm running into an error while checking the challenge:

"The AddBoatReview controller's onSave() function doesn't fire the BoatReviewAdded event."

The problem is that I'm testing the component right now, and my event is being received by the parent just fine, and my tabset switches to the "Reviews" section like it should, so know it's being handled correctly. I've tried using both a Component event and an Application event just to debug a bit (even though Component is the best option for this scenario), and that doesn't change anything. Any idea what could be triggering this error message?

Relevant code:

AddBoatReviewController.js

onSave : function(component, event, helper){
    	component.set("v.boatReview.Boat__c",component.get("v.boat.Id"));

        component.find("service").saveRecord(function(saveResult) {
            if (saveResult.state === "SUCCESS" || saveResult.state === "DRAFT") {

               var cmpEvent = component.getEvent("reviewAdded");
		       cmpEvent.fire();

               //Attempt at trying an Application event instead
		       //var cmpEvent = $A.get("e.c:BoatReviewAdded");
		       //cmpEvent.fire();


                var resultsToast = $A.get("e.force:showToast");
                //Toast code and other saveResults states below...
AddBoatReview.cmp
<aura:registerEvent name="reviewAdded" type="c:BoatReviewAdded"/>
     
    <!-- Display form -->
    <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>
BoatDetails.cmp
<aura:handler name="reviewAdded" event="c:BoatReviewAdded" action="{!c.onBoatReviewAdded}"/>

BoatDetailsController.js

onBoatReviewAdded : function(component, event, helper) {
	console.log("Event received");
	component.set("v.selTabId", "boatreviewtab");
}
HI All,

I am facing an issue with step 3 of the superbatch and getting the below error
Error

I tried multiple options in the component code.but none of them worked here
Option1 
<aura:attribute name="boat" type="Boat__c" />
<ul class="slds-has-dividers--bottom-space">
        <li class="slds-item  slds-float_left">
     <lightning:tile class="tile ">
        
             <lightning:button aura:id="{!v.boat.Id}" name="{!v.boat.Name}" class="tile">
                 <div style="{!'background-image:URL(\'https://resourceful-badger-249681-dev-ed.my.salesforce.com'+v.boat.Picture__c+'\')'}" class="innertile">
                 	
                      <div class="lower-third">
                			<h1 class="slds-truncate">{!v.boat.Contact__r.Name}</h1>
              			</div>
                 </div>
            </lightning:button>
         
            
    </lightning:tile>
         </li>
    </ul>
Option 2
<aura:attribute name="boat" type="Boat__c" />
<ul class="slds-has-dividers--bottom-space">
        <li class="slds-item  slds-float_left">
     
        
             <lightning:button aura:id="{!v.boat.Id}" name="{!v.boat.Name}" class="tile">
                 <div style="{!'background-image:URL(\'https://resourceful-badger-249681-dev-ed.my.salesforce.com'+v.boat.Picture__c+'\')'}" class="innertile">
                 	
                      <div class="lower-third">
                			<h1 class="slds-truncate">{!v.boat.Contact__r.Name}</h1>
              			</div>
                 </div>
            </lightning:button>
         
            

         </li>
    </ul>
Option 3
<aura:attribute name="boat" type="Boat__c" />
   <lightning:tile class="slds-tile--board">
     <lightning:button class="tile">
        <div style="{!'background-image:URL(\'https://resourceful-badger-249681-dev-ed.my.salesforce.com'+v.boat.Picture__c+'\')'}" class="innertile">
          <div class="lower-third">
           <h1 class="slds-truncate">{!v.boat.Contact__r.Name}</h1>
          </div>
        </div>
    </lightning:button>
    </lightning:tile>


 
I am getting below error
User-added image

but my application has 
User-added image

May I know why am not able to pass this challenge ?