• Rafael Suarez Marquez
  • NEWBIE
  • 15 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 5
    Replies
Hi All; Happy Holidays.

I'm on Step #8 "Set up Lightning Experience for Lusso’s support team",   using a playground org generated on Nov 28 2017 (Winter 18).

Logged into Lightning, set my user Knowledge checkbox, and quick searched for "Knowledge"... Nothing.  "Lightning Knowledge"... Nothing!  
Switched to Service setup, and searched again for the same... Nothing !!!

Browsed This Official Document and made sure I was following the steps in page 12... Nothing!


No Knowledge

I ran out of patience and gave up on Lightning once more (probably for the hundredth time), switched to classic, and found "Knowledge Settings" real quick within Build->Customize...

I'm not a superfan of lightning.  Could my attitude be causing me to miss something?
Yeah, I noticed this afterwards... but  why is the Quicksearch Failing?
User-added image
I had so much trouble with this one section that I feel like I have to post this to help out those who are struggling as much as me. Three hours for a simple controller... The problem is the way trailhead tests the challenge is hard for them and they have very strict criteria that is not implicit in the challenge directions.

camingList.cmp
<aura:component >
    
	<aura:attribute name="newItem" type="Camping_Item__c"  default="{'sobjectType': 'Camping_Item__c', 'Quantity__c': 0, 'Price__c': 0.00}" required="true"/>
	<aura:attribute name="items" type="Camping_Item__c[]"/>
	<lightning:layout class="slds-page-header slds-page-header--object-home">
        <lightning:layoutItem >
            <lightning:icon iconName="standard:scan_card" alternativeText="My Campign Items"/>
        </lightning:layoutItem>
        <lightning:layoutItem padding="horizontal-small">
            <div class="page-section page-header">
                <h1 class="slds-text-heading--label">Camping Items</h1>
                <h2 class="slds-text-heading--medium">My Camping Items</h2>
            </div>
        </lightning:layoutItem>
    </lightning:layout>
    <!-- / PAGE HEADER -->

    <!-- NEW EXPENSE FORM -->
    <lightning:layout >
        <lightning:layoutItem padding="around-small" size="6">

        <!-- CREATE NEW EXPENSE -->
    <div aria-labelledby="newitemform">

        <!-- BOXED AREA -->
        <fieldset class="slds-box slds-theme--default slds-container--small">

        <legend id="newitemform" class="slds-text-heading--small 
          slds-p-vertical--medium">
          Add Camping Item
        </legend>
  
        <!-- CREATE NEW EXPENSE FORM -->
        <form class="slds-form--stacked">          
            <lightning:input aura:id="itemform" label="Item Name"
                             name="itemname"
                             value="{!v.newitem.Name}"
                             required="true"/> 
            <lightning:input type="itemform" aura:id="itemform" label="Amount"
                             name="itemprice"
                             min="0.1"
                             formatter="currency"
                             step="0.01"
                             value="{!v.newitem.Price__c}"
                             messageWhenRangeUnderflow="Enter an amount that's at least $0.10."/>
            <lightning:input aura:id="itemform" label="Quantity"
                             name="itemquantity"
                             value="{!v.newitem.Quantity__c}"
							 min="1"
							 type="number"
							 required="true"
							 messageWhenRangeUnderflow="Enter minimum 1 Quantity"/>
                             />
            <lightning:input type="checkbox" aura:id="itemform" label="Packed?"  
                             name="packed"
							 class="slds-checkbox"
                             checked="{!v.newitem.Packed__c}"/>
            <lightning:button label="Create Camping Item" 
                              class="slds-m-top--medium"
                              variant="brand"
                              onclick="{!c.clickCreateItem}"/>
        </form>
        <!-- / CREATE NEW EXPENSE FORM -->
  
      </fieldset>
      <!-- / BOXED AREA -->

    </div>
    <!-- / CREATE NEW EXPENSE -->

        </lightning:layoutItem>
    </lightning:layout>
    <!-- / NEW EXPENSE FORM -->
	
	<div class="slds-card slds-p-top--medium">
        <header class="slds-card__header">
            <h3 class="slds-text-heading--small">Camping</h3>
        </header>
        
        <section class="slds-card__body">
            <div id="list" class="row">
                <aura:iteration items="{!v.items}" var="cmp">
                    <c:campingListItem item="{!cmp}"/>
                </aura:iteration>
            </div>
        </section>
	</div>
</aura:component>

campingList.Controller
({
		handleAddItem: function(component, event, helper) {
    var addItm = event.getParam("item");
    helper.createItem(component, addItm);

},

    createItem: function(component, newItem) {
    var action = component.get("c.clickCreateItem");
    action.setParams({
        "item": newItem
    });
    action.setCallback(this, function(response){
        var state = response.getState();
        if (component.isValid() && state === "SUCCESS") {
            var items = component.get("v.items");
            items.push(response.getReturnValue());
            component.set("v.items", items);
        }
    });
    $A.enqueueAction(action);
},
    clickCreateItem: function(component, event, helper) {
		
        var validItem = component.find('itemform').reduce(function (validSoFar, inputCmp) {
            // Displays error messages for invalid fields
            inputCmp.showHelpMessageIfInvalid();
            return validSoFar && inputCmp.get('v.validity').valid;
        }, true);
        
        
        // ... hint: more error checking here ...

        // If we pass error checking, do some real work
        if(validItem){
            // Create the new expense
            var newItem = component.get("v.newItem");
            console.log("Create Camping Item: " + JSON.stringify(newCamping));
            handleAddItem(component, newItem);
        }
		component.set("v.newItem",{'sobjectType':'Camping_Item__c',
                'Name': '',
                'Quantity__c': 0,
                'Price__c': 0,
                'Packed__c': false});
    }
})
camping.cmp
<aura:component implements="flexipage:availableForRecordHome">
	<br/><br/><br/>
    <c:campingHeader />
    <c:campingList />
</aura:component>

campingHeader.cmp
<aura:component >
	<lightning:layout class="slds-page-header">
		<lightning:layoutItem >
			<lightning:icon iconName="action:goal"/>
		</lightning:layoutItem>

		<div class="slds-page-header">
			<h1 class="slds-text-heading--label"> Camping List </h1>
		</div>
	</lightning:layout>
</aura:component>

campingListItem.cmp
 
<aura:component >
    <aura:attribute name="item" type="Camping_Item__c"/>
    
    <p>Name:
        <ui:outputText value="{!v.item.Name}"/>
    </p>
    <p>Price:
        <ui:outputCurrency value="{!v.item.Price__c}"/>
    </p>
    <p>Quantity:
        <ui:outputNumber value="{!v.item.Quantity__c}"/>
    </p>
    <p>Packed:
        <ui:outputCheckbox value="{!v.item.Packed__c}"/>
    </p>
</aura:component>

Any other controllers or helper classes are not needed. That is the trick here. Using helper classes when not specified fails the challenge. I hope you will read through and understand this code as I have to realize why it is this way and not simply copypasta.

Enjoy!
 
Hi All; Happy Holidays.

I'm on Step #8 "Set up Lightning Experience for Lusso’s support team",   using a playground org generated on Nov 28 2017 (Winter 18).

Logged into Lightning, set my user Knowledge checkbox, and quick searched for "Knowledge"... Nothing.  "Lightning Knowledge"... Nothing!  
Switched to Service setup, and searched again for the same... Nothing !!!

Browsed This Official Document and made sure I was following the steps in page 12... Nothing!


No Knowledge

I ran out of patience and gave up on Lightning once more (probably for the hundredth time), switched to classic, and found "Knowledge Settings" real quick within Build->Customize...

I'm not a superfan of lightning.  Could my attitude be causing me to miss something?
Yeah, I noticed this afterwards... but  why is the Quicksearch Failing?
User-added image
Hi,

I am getting the error as below

Didn't find the All Lusso Scarpe Employee group record page

Could you please suggest me
I'm struggling with the custom lightning component on this part. I don't have much background coding and am having trouble finding resources to help me achieve coding the lightning component. If someone could help give me some framework code to create a custom lightning component to hold a URL or direct me to a resource that help break this down I'd be very appreciative.
 
I am stuck at  this point:

User-added image
I just want to know what is going to be the syntax for resetting the newItem value provider with a Camping_Item__c sObject??

My Code is as follows:

(1) campingList Component:
 
<aura:component >
	
    <aura:attribute name="newItem" type="Camping_Item__c"
     default="{ 'sobjectType': 'Camping_Item__c',
                    'Name': '',
                    'Quantity__c': 0,
                    'Price__c': 0,
                    'Packed__c': false }"/>
    
    <aura:attribute name="items" type="Camping_Item__c[]"/>
    
    <ol>
    <li>Bug Spray</li>
    <li>Bear Repellant</li>
    <li>Goat Food</li>
    </ol>
    
    <!-- CREATE NEW ITEM FORM -->
    <form class="slds-form--stacked">

      <div class="slds-form-element slds-is-required">
          <div class="slds-form-element__control">
              <ui:inputText aura:id="itemname" label="Name"
                  class="slds-input"
                  labelClass="slds-form-element__label"
                  value="{!v.newItem.Name}"
                  required="true"/>
          </div>
     </div>

     <div class="slds-form-element slds-is-required">
          <div class="slds-form-element__control">
              <ui:inputNumber aura:id="quantity" label="Quantity"
                  class="slds-input"
                  labelClass="slds-form-element__label"
                  value="{!v.newItem.Quantity__c}"
                  required="true"/>

          </div>
      </div>

      <div class="slds-form-element">
          <div class="slds-form-element__control">
              <ui:inputCurrency aura:id="price" label="Price"
                  class="slds-input"
                  labelClass="slds-form-element__label"
                  value="{!v.newItem.Price__c}"
                  />
          </div>
      </div>

      <div class="slds-form-element">
          <ui:inputCheckbox aura:id="packed" label="Packed?"
              class="slds-checkbox"
              labelClass="slds-form-element__label"
              value="{!v.newItem.Packed__c}"/>
      </div>

      <div class="slds-form-element">
          <ui:button label="Create Camping Item"
              class="slds-button slds-button--brand"
              press="{!c.clickCreateItem}"/>
      </div>

    </form>
    <!-- / CREATE NEW ITEM FORM -->
    
   

    <div class="slds-card slds-p-top--medium">
        <header class="slds-card__header">
            <h3 class="slds-text-heading--small">Items</h3>
        </header>
        
        <section class="slds-card__body">
            <div id="list" class="row">
                <aura:iteration items="{!v.items}" var="items">
                    <c:campingListItem item="{!item}"/>
                </aura:iteration>
            </div>
        </section>
    </div>

</aura:component>

(2) Controller code:
 
({
    clickCreateItem: function(component, event, helper) {

        // Simplistic error checking
        var validItem = true;

        // Name must not be blank
        var nameField = component.find("itemname");
        var itemname = nameField.get("v.value");
        if ($A.util.isEmpty(itemname)){
            validItem = false;
            nameField.set("v.errors", [{message:"Item name can't be blank."}]);
        }
        else {
            nameField.set("v.errors", null);
        }
        
        // Quantity must not be blank
        var quantityField = component.find("quantity");
        var quantity = nameField.get("v.value");
        if ($A.util.isEmpty(quantity)){
            validItem = false;
            quantityField.set("v.errors", [{message:"Quantity can't be blank."}]);
        }
        else {
            quantityField.set("v.errors", null);
        }

        var priceField = component.find("price");
        var price = priceField.get("v.value");
        if ($A.util.isEmpty(price)){
            validItem = false;
            priceField.set("v.errors", [{message:"Price can't be blank."}]);
        }
        else {
            quantityField.set("v.errors", null);
        }


        if(validItem){
            var newItem = component.get("v.newItem");
            console.log("Create item: " + JSON.stringify(newItem));
            //helper.createItem(component, newItem);
            //        var theItems = component.get("v.items");
 
        // Copy the expense to a new object
        // THIS IS A DISGUSTING, TEMPORARY HACK
        var newItem = JSON.parse(JSON.stringify(item));
 
        console.log("Items before 'create': " + JSON.stringify(theItems));
		theExpenses.push(newItem);
		component.set("v.expenses", theItems);
		console.log("Items after 'create': " + JSON.stringify(theItems));
        theItems.push(newItem);
        component.set("v.items", theItems);
        
        }
    }
})