• Ruben Halman
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies
Hi,

I do not understand why, but for some reason my Checkmark Input is not getting retrieved correctly.
It is always FALSE when creating a newItem, even when I put it to true.

I have been stuck on this for a while and hoping for some help!

THE 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[]"/>

    <div class="slds-col slds-col--padded slds-p-top--large">
        <div aria-labelledby="newItemform">
            <fieldset class="slds-box slds-theme--default slds-container--small">
                <legend id="newexpenseform" class="slds-text-heading--small slds-p-vertical--medium">
                    Add Camping Item
                </legend>

                <form class="slds-form--stacked">
                    <div class="slds-form-element slds-is-required">
                        <div class="slds-form-element__control">
                            <lightning:input name="expname" label="Camping Item Name"
                                             class="slds-input slds-form-element__label"
                                             value="{!v.newItem.Name}" aura:id="expname"
                                             required="true"/>
                        </div>
                    </div>

                    <div class="slds-form-element slds-is-required">
                        <div class="slds-form-element__control">
                            <lightning:input type="number" label="Quantity" maxlength="10" min="1"
                                             name="quantity" class="slds-input slds-form-element__label"
                                             value="{!v.newItem.Quantity__c}" aura:id="quantity"
                                             required="true"/>
                        </div>
                    </div>

                    <div class="slds-form-element">
                        <div class="slds-form-element__control">
                            <lightning:input type="number" name="price" label="Price" formatter="currency" step="0.01" 
                                             class="slds-input slds-form-element__label"
                                             value="{!v.newItem.Price__c}" aura:id="price"
                                             />
                        </div>
                    </div>

                    <div class="slds-form-element">
                        <lightning:input type="checkbox" name="packed" label="Packed"
                                         class="slds-checkbox slds-form-element__label"
                                         aura:id="packed"
                                         value="{!v.newItem.Packed__c}"/>
                    </div>

                    <div class="slds-form-element">
                        <lightning:button label="Create Expense"
                                          class="slds-button slds-button--brand"
                                          onclick="{!c.clickCreateItem}"/>
                    </div>
                </form>
            </fieldset>
        </div>
    </div>
    <section class ="slds-card__body">
        <div id="list" class = "row">
            <aura:iteration items="{!v.items}" var="item">
                <c:campingListItem item="{!item}"/>
            </aura:iteration>
        </div>
    </section>
</aura:component>
THE CONTROLLER:
({
    clickCreateItem: function(component, event, helper) {
        // Simplistic error checking
        var validCamp = true;
        // get Value from expname input
        var textField = component.find("expname");
        console.log("--textField--"+textField);
        var textValue = textField.get("v.value");
        console.log('textValue = '+textValue);

        // get Value from quantity input
        var quantityField = component.find("quantity");
        console.log("--quantityField--"+quantityField);
        var quantityValue = quantityField.get("v.value");
        console.log('quantityValue = '+quantityValue);

        // get Value from price input
        var priceField = component.find("price");
        console.log("--priceField--"+priceField);
        var priceValue = priceField.get("v.value");
        console.log('priceValue = '+priceValue);

        // get Value from checkMark
        var checkmarkField = component.find("packed");
        console.log("--checkmarkField--"+checkmarkField);
        var checkmarkValue = checkmarkField.get("v.value");
        console.log('checkmarkValue = '+checkmarkValue);


        // //TEST INPUT
        if ($A.util.isEmpty(textValue)){
            validCamp = false;
            textField.set("v.errors", [{message:"Camping Item name can't be blank."}]);
        }
        else {
            textField.set("v.errors", null);
        }
       
        if (validCamp == true && quantityValue < 1){
            validCamp = false;
            quantityField.set("v.errors", [{message:"Camping Item's quantity should be greater or equal 1."}]);
        }
        else {
            quantityField.set("v.errors", null);
        }
        priceField.set("v.errors", null);
        checkmarkField.set("v.errors", null);
        //
        // //LOGIC
        //
        if(validCamp){
        //
             var itemObj = component.get("v.newItem");
             console.log("---itemObj---"+itemObj);
             console.log("Create camping item : " + JSON.stringify(itemObj));
             var theItems = component.get("v.items");
        
             // Copy the expense to a new object
        
             var newItem = JSON.parse(JSON.stringify(itemObj));
             //var newItem = itemObj;
             console.log("Expenses before 'create': " + JSON.stringify(theItems));
             theItems.push(newItem);
             component.set("v.items", theItems);
             console.log("Expenses after 'create': " + JSON.stringify(theItems));
             var newItemObj = {'sobjectType': 'Camping_Item__c',
                 'Name': '',
                 'Quantity__c': 0,
                 'Price__c': 0 };
             //resetting the Values in the form
             component.set("v.newItem",newItemObj);
             alert('the items value provider has changed');
        }
    }
})

Dear community,

I am at a total loss as to why im getting an error as the variable is exactly how the challenge asks me to make.
Im stuck with the trailhead challenge: 'Automate Your Business ProcessesBuild an Account Reassignment Wizard'
At the 'Build Lookup Logic to Find Matching Salesforce Users' part.

I have repeadetely followed the instructions carefully however I keep getting the following error:
sObject collection variable 'User1_Accounts' isn't properly configured. Check the instructions.

My flow is as illustrated in the challenge:
flows
My flow is as illustrated in the challenge:
User-added image


Any help or tips would be greatly appreciated!

Hello dear community!

Im stuck at the Build Your Branding, Button, and Deployment module in Trailhead with the following error:
"Chat Button is not setup properly. Please follow instructions carefully."
I absolutely do not understand what part is wrong so if someone could help me out that would be fantastic!
My Chat Button is as following:

Type  Chat Button
Name  Chat Button
Developer Name  Chat_Button
Site for Resources  BruxistPlayground
Online Image  ChatWindow

Greetings from a newbie

Hi,

I do not understand why, but for some reason my Checkmark Input is not getting retrieved correctly.
It is always FALSE when creating a newItem, even when I put it to true.

I have been stuck on this for a while and hoping for some help!

THE 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[]"/>

    <div class="slds-col slds-col--padded slds-p-top--large">
        <div aria-labelledby="newItemform">
            <fieldset class="slds-box slds-theme--default slds-container--small">
                <legend id="newexpenseform" class="slds-text-heading--small slds-p-vertical--medium">
                    Add Camping Item
                </legend>

                <form class="slds-form--stacked">
                    <div class="slds-form-element slds-is-required">
                        <div class="slds-form-element__control">
                            <lightning:input name="expname" label="Camping Item Name"
                                             class="slds-input slds-form-element__label"
                                             value="{!v.newItem.Name}" aura:id="expname"
                                             required="true"/>
                        </div>
                    </div>

                    <div class="slds-form-element slds-is-required">
                        <div class="slds-form-element__control">
                            <lightning:input type="number" label="Quantity" maxlength="10" min="1"
                                             name="quantity" class="slds-input slds-form-element__label"
                                             value="{!v.newItem.Quantity__c}" aura:id="quantity"
                                             required="true"/>
                        </div>
                    </div>

                    <div class="slds-form-element">
                        <div class="slds-form-element__control">
                            <lightning:input type="number" name="price" label="Price" formatter="currency" step="0.01" 
                                             class="slds-input slds-form-element__label"
                                             value="{!v.newItem.Price__c}" aura:id="price"
                                             />
                        </div>
                    </div>

                    <div class="slds-form-element">
                        <lightning:input type="checkbox" name="packed" label="Packed"
                                         class="slds-checkbox slds-form-element__label"
                                         aura:id="packed"
                                         value="{!v.newItem.Packed__c}"/>
                    </div>

                    <div class="slds-form-element">
                        <lightning:button label="Create Expense"
                                          class="slds-button slds-button--brand"
                                          onclick="{!c.clickCreateItem}"/>
                    </div>
                </form>
            </fieldset>
        </div>
    </div>
    <section class ="slds-card__body">
        <div id="list" class = "row">
            <aura:iteration items="{!v.items}" var="item">
                <c:campingListItem item="{!item}"/>
            </aura:iteration>
        </div>
    </section>
</aura:component>
THE CONTROLLER:
({
    clickCreateItem: function(component, event, helper) {
        // Simplistic error checking
        var validCamp = true;
        // get Value from expname input
        var textField = component.find("expname");
        console.log("--textField--"+textField);
        var textValue = textField.get("v.value");
        console.log('textValue = '+textValue);

        // get Value from quantity input
        var quantityField = component.find("quantity");
        console.log("--quantityField--"+quantityField);
        var quantityValue = quantityField.get("v.value");
        console.log('quantityValue = '+quantityValue);

        // get Value from price input
        var priceField = component.find("price");
        console.log("--priceField--"+priceField);
        var priceValue = priceField.get("v.value");
        console.log('priceValue = '+priceValue);

        // get Value from checkMark
        var checkmarkField = component.find("packed");
        console.log("--checkmarkField--"+checkmarkField);
        var checkmarkValue = checkmarkField.get("v.value");
        console.log('checkmarkValue = '+checkmarkValue);


        // //TEST INPUT
        if ($A.util.isEmpty(textValue)){
            validCamp = false;
            textField.set("v.errors", [{message:"Camping Item name can't be blank."}]);
        }
        else {
            textField.set("v.errors", null);
        }
       
        if (validCamp == true && quantityValue < 1){
            validCamp = false;
            quantityField.set("v.errors", [{message:"Camping Item's quantity should be greater or equal 1."}]);
        }
        else {
            quantityField.set("v.errors", null);
        }
        priceField.set("v.errors", null);
        checkmarkField.set("v.errors", null);
        //
        // //LOGIC
        //
        if(validCamp){
        //
             var itemObj = component.get("v.newItem");
             console.log("---itemObj---"+itemObj);
             console.log("Create camping item : " + JSON.stringify(itemObj));
             var theItems = component.get("v.items");
        
             // Copy the expense to a new object
        
             var newItem = JSON.parse(JSON.stringify(itemObj));
             //var newItem = itemObj;
             console.log("Expenses before 'create': " + JSON.stringify(theItems));
             theItems.push(newItem);
             component.set("v.items", theItems);
             console.log("Expenses after 'create': " + JSON.stringify(theItems));
             var newItemObj = {'sobjectType': 'Camping_Item__c',
                 'Name': '',
                 'Quantity__c': 0,
                 'Price__c': 0 };
             //resetting the Values in the form
             component.set("v.newItem",newItemObj);
             alert('the items value provider has changed');
        }
    }
})

Hello dear community!

Im stuck at the Build Your Branding, Button, and Deployment module in Trailhead with the following error:
"Chat Button is not setup properly. Please follow instructions carefully."
I absolutely do not understand what part is wrong so if someone could help me out that would be fantastic!
My Chat Button is as following:

Type  Chat Button
Name  Chat Button
Developer Name  Chat_Button
Site for Resources  BruxistPlayground
Online Image  ChatWindow

Greetings from a newbie

Problem Statement:

Create a form to enter new items and display the list of items entered. To make our camping list look more appealing, change the campingHeader component to use the SLDS. Similar to the unit, style the Camping List H1 inside the slds-page-header. Modify the campingList component to contain an input form and an iteration of campingListItem components for displaying the items entered.
  • The component requires an attribute named items with the type of an array of camping item custom objects.
  • The component requires an attribute named newItem of type Camping_Item__c with default quantity and price values of 0.
  • The component displays the Name, Quantity, Price, and Packed form fields with the appropriate input component types and values from the newItem attribute.
  • The JavaScript controller checks to ensure that the Name, Quantity and Price values submitted are not null.
  • If the form is valid, the JavaScript controller pushes the newItem onto the array of existing items, triggers the notification that the items value provider has changed, and resets the newItem value provider with a blank sObjectType of Camping_Item__c.

My Code:

CampingList.cmp

 
<aura:component >
	<ol>
        <li>Bug Spray</li>
        <li>Bear Repellant</li>
        <li>Goat Food</li>
    </ol>
 <aura:attribute name="items" type="Camping_Item__c[]"/>
 <aura:attribute name="newItem" type="Camping_Item__c"
     default="{'sobjectType': 'Camping_Item__c',
                    'Name': '',
                    'Price__c': 0,
                    'Quantity__c': 0,
                    'Packed__c': false }"/>    
    <div style = "slds">
    <div class="slds-col slds-col--padded slds-p-top--large">
		<div aria-labelledby="newform">
			<fieldset class="slds-box slds-theme--default slds-container--small">
				<legend id="newform" class="slds-text-heading--small slds-p-vertical--medium">New Form</legend>
				<form class="slds-form--stacked">
					<div class="slds-form-element slds-is-required">
						<div class="slds-form-element__control">
							<ui:inputText aura:id="formname" 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:inputCurrency aura:id="formprice" label="Price" class="slds-input" labelClass="slds-form-element__label" value="{!v.newItem.Price__c}" placeholder="0"/>
						</div>
					</div>
					<div class="slds-form-element">
						<div class="slds-form-element__control">
							<ui:inputNumber aura:id="formquantity" label="Quantity" class="slds-input" labelClass="slds-form-element__label" value="{!v.newItem.Quantity__c}" required="true" placeholder="0"/>
						</div>
					</div>
					<div class="slds-form-element">
						<ui:inputCheckbox aura:id="formpacked" 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 Form" class="slds-button slds-button--brand" press="{!c.clickCreateFormData}"/>
					</div>
				</form>
			</fieldset>
		</div>
    </div>

    <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="items">
                    <c:campingListItem item="{!items}"/>
                </aura:iteration>
            </div>
        </section>
    </div>    
	</div>
</aura:component>
CampingListController.js:
 
({
    clickCreateFormData: function(component, event, helper) {

        var validitem = true;
        
        var nameField = component.find("formname");
        var expname = nameField.get("v.value");
		if ($A.util.isEmpty(expname)){
            validitem = false;
            nameField.set("v.errors", [{message:"Expense name can't be blank."}]);
        }
        else {
            nameField.set("v.errors",null);
        }
        
        var priceField = component.find("formprice");
        var expprice = nameField.get("v.value");
            if ($A.util.isEmpty(expprice)){
            validitem = false;
            priceField.set("v.errors", [{message:"Expense price can't be blank."}]);
        }
        else{
            priceField.set("v.errors",null);
        }
        
        var quantityField = component.find("formquantity");
        var expquantity = nameField.get("v.value");
        if ($A.util.isEmpty(expquantity)){
            validitem = false;
            quantityField.set("v.errors", [{message:"Expense quantity can't be blank."}]);
        }
        else{
            quantityField.set("v.errors",null);
        } 
        
      /*  if(validExpense){
            var newItem = component.get("v.newItem");
            console.log("Create item: " + JSON.stringify(newItem));
            helper.createExpense(component, newItem);
        } */
         if(validitem){
            var newItem = component.get("v.newItem");
            console.log("Create item: " + JSON.stringify(newItem));
        	var theItem = component.get("v.items");
            var newItem = JSON.parse(JSON.stringify(newItem));
            theItem.push(newItem);
            component.set("v.newItem",newItem);
        }
        component.set("v.newItem",{'sobjectType': 'Camping_Item__c',
                    'Name': '',
					'Price__c': 0,                                   
                    'Quantity__c': 0,
                    'Packed__c': false });
    }
})
CampingListItem.cmp:
 
<aura:component implements="force:appHostable">
   <aura:attribute name="item" type="Camping_Item__c"/>
     <p>The Item is: 
         <ui:outputText value="{!v.item}" />
    </p> 
    <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>
    
  <!--  <p>
    	<ui:button label="Packed!" press="{!c.packItem}"/>
    </p> -->
</aura:component>

Could anyone help pass and run the challenge.

Thanks.