• Saket Ranjan 3
  • NEWBIE
  • 44 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 2
    Questions
  • 27
    Replies
While going through "Apex web services" in the badge :Apex integration services" i was getting error :"No Apex class named 'DemoController' was found".
Though it got resolved by just creating and saving an empty Apex class "DemoController" i have no clue why this error came at first place,as there were nothing mention about any class naming "DemoController" in the challenge.
WHy ! wHy! whY!!!!!??????
User-added imagewhen i am using <ui> tags then its working but the moment i move to lightening tag its throwing above error,. i am new to the salesforce development.



campingListForm.cmp::

<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:registerEvent name="addItem" type="c:addItemEvent"/>
    <!-- CREATE NEW ITEM FORM -->
   <form >

      <div >
          <div >
               <lightning:input aura:id="itemname"
                                    value="{!v.newItem.Name}"
                                label="Name" 
                                required="true"/>
              <!--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.Quantities__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.submitForm}"/>
      </div>

    </form>
    <!-- / CREATE NEW ITEM FORM -->
</aura:component>

campingListFormController.js:

({
    
    submitForm : function(component, event, helper) {    
    if(helper.validateItemForm(component)){
          console.log("submitForm of campingListFormController");
        // Create the new item
        var newItem = component.get("v.newItem");
        helper.createItem(component, newItem);
    }
        
        }

})

campingListFormHelper.js ::

({
    
    
    createItem : function(component) {
        var newItem = component.get("v.newItem");
        var addEvent = component.getEvent("addItem");
        addEvent.setParams({"item" : newItem});
         console.log("createItem of campingListFormHelper");
        addEvent.fire();
        component.set("v.newItem",
                      { 'sobjectType': 'Camping_Item__c',
                       'Name': '',
                       'Packed__c': false,
                       'Price__c': 0,
                       'Quantity__c': 0});
    },
    
    
    validateItemForm: function(component) {
         
        // Simplistic error checking
        var validItem = true;
       console.log("validateItemForm of campingListFormHelper");
        // 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);
        }
        // Price must not be blank
        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);
        }
        return (validItem);
        
    }
})

 
hi, i have created an lwc component. when i am trying to deploy it into org it is showing  XML parse error: Unexpected xml:   .
User-added imagethis is my XML file.

when if removing <targets> tag ...then the component is getting deployed.

did anybody face this issue?
pls help..
Hey guys trying to get comfortable with the Salesforce CLI, and went to deploy my code changes to my Dev Org but I keep getting the following error message. I checked out the link that they listed, but couldn't seem to figure out what issue was. I modified the JSON with the folder name that I'm trying to deploy, but still had no luck. 
 
Error deploying or retrieving source: The file or directory that you tried to deploy or retrieve isn't in a package directory that's specified in your sfdx-project.json file. Add this location to your "packageDirectories" value, or deploy or retrieve a different file or directory. For details about sfdx-project.json, see: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_config.htm

 
Hi!

I started on the Lightning Experience Reports & Dashboards Specialist superbadge and made it all the way to Step 7 (Create the SolarBot dashboard) to get this error message. I started a completely new org for this superbadge module and was wondering if anyone could provide assistance? It's taken me a while to get to this point, so I'd hate to have to start over now. Any help is much appreciated!!

Challenge Not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: ZKSWPWKT
For life of me I can't figure out what this exercise is asking to do.  I was able to modify other reports but this particualr R&D report, Temperature to kWh Research, I'm not able to do.  Error is keep saying, "We can’t find the additional analysis by model being performed on the 'Temperature to kWh Research' report. Remember that you can organize data horizontally and vertically at the same time."

User-added image


 
Hi, I have completed the test class for the Test Automation logic  challenge. Both my trigger and helper class are getting 100% covered. But the challenge is not complted due to the following error:

Challenge Not yet complete... here's what's wrong: 
The 'MaintenanceRequestHelper' class did not achieve 100% code coverage via your test methods. Make sure that you chose 'Run All' tests in the Developer Console at least once before attempting to verify this challenge.


Can some one point me in the right direction to move forward with the badge completion. TIA !!!

Hi All,

I'm unable to save my Lightning Component, becase it keeps throwing this error Invalid <aura:attribute> type: Wrapperobj[]

Attribute declaration: 
 <aura:attribute name="contactList" type="SearchLeads.Wrapperobj[]" />
Class name : SearchLeads
Wrapper class name : Wrapperobj

I'm facing this issue, after my org got updated to SPRING 18

Thanks in advance!
Lavanya

Component Code:

    <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">

                  <lightning:input aura:id="itemname" label="Name"

                      class="slds-input"

                      

                      value="{!v.newItem.Name}"

                      required="true"/>

              </div>

         </div>

    

         <div class="slds-form-element slds-is-required">

              <div class="slds-form-element__control">

                 <lightning:input type="number" label="Quantity"
                                        class="slds-input"
                                        name="quantity"
                                        min="1"
                                        value="{!v.newItem.Quantity__c}"
                                        required="true" aura:id="quantity"/>

    

              </div>

          </div>

    

          <div class="slds-form-element">

              <div class="slds-form-element__control">

                  <lightning:input type= "number" aura:id="price" label="Price"
                                   formatter="currency"

                      class="slds-input"

                     value="{!v.newItem.Price__c}" />

              </div>

          </div>
    

          <div class="slds-form-element">

              <lightning:input type = "checkbox" aura:id="itemform" label="Packed?"

                  class="slds-checkbox"

                  

                  checked="{!v.newItem.Packed__c}"/>

          </div>

    

          <div class="slds-form-element">

              <lightning:button label="Create Camping Item"

                  class="slds-button slds-button--brand"

                  onclick="{!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>

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);

    }
}

})


Requesting your help to let me know what is wrong with the code?
I'm trying to create a new playground, but am unable to do so.  When I try to select create new trailhead playground, nothing happens.  The list doesn't even register that my curser is hovering over the options in the list.  What am I doing wrong?
Hello Everyone,

I am new to SF Lightning, getting above issue while retrieving 10 accouts record on Lightning Builder App.

Kindly assist to resolve this issue.

----AccountPracticeLC.apxc---------------------

public class AccountPracticeLC {
 public static List<Account> ListAct;
 @AuraEnabled
 public static List<Account> FetchAccountRecord(){
     ListAct = [select Name, AccountNumber, Phone, Industry from Account Limit 10];
     return ListAct;      
    }
}

-------------AccountPracticeLC_Cmp.cmp-----------------

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" controller ="AccountPracticeLC" >
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
      <aura:attribute name="Accounts" type="Account[]"/>
    <section class="slds-card__body">
                   
          <div class="slds-tile slds-hint-parent">
              <p class="slds-tile__title slds-truncate">Name: 
                  <ui:outputText value="{!v.Accounts.Name}"/>
              </p>
        <p class="slds-truncate">Account Number: 
            <ui:outputText value="{!v.Accounts.AccountNumber}"/>
        </p>
        <p class="slds-truncate">Phone:
            <ui:outputNumber value="{!v.Accounts.Phone}" />
        </p>
                      <p class="slds-truncate">Industry:
            <ui:outputText value="{!v.Accounts.Industry}" />
        </p>

    </div>
        </section>  
    
  </aura:component>

--------------------------Controller---------------

({
    doInit : function(component, event, helper) {
       
       helper.FetchAccountRecord(component);
    },
})

-------------------------Helper--------------------

({
  FetchAccountRecord: function(component) {
        var action = component.get("c.FetchAccountRecord");
        action.setCallback(this, function(data) {
            var state = data.getState();
            if (component.isValid() && state === "SUCCESS") {
                component.set("v.Accounts", data.getReturnValue());
                system.log(response.getReturnValue());
            }
        });
        $A.enqueueAction(action);
        },    
})
I'm trying to complete the Handle Record Changes and Errors module but can't seem to get past the following challenge error:
Challenge Not yet complete... here's what's wrong: 
The 'accEdit' Lightning Component JS Controller does not appear to be setting 'v.recordSaveError' with an error message.

.I've tried many different combinations of sets and am not having much luck.

I've tried several different component.set methods such as this one:
component.set('v.recordSaveError','Error: ' + saveResult.state + ', message: ' + JSON.stringify(saveResult.error));

Any ideas what this module is looking for as a valid solution?

I do see recordSaveError display after being set due to an error.

Thanks.
 
Sir,

I am experiencing great difficulty with the following Trailhead module:

Lightning Components Basics, Connect to Salesforce with Server-Side Controllers

located at:  https://trailhead.salesforce.com/modules/lex_dev_lc_basics/units/lex_dev_lc_basics_server

*****************************************************************************************************************************

Here is my code:

(campingList.cmp)

<aura:component >
   
 <aura:attribute name="items" type="Camping_Item__c[]"/>
    <aura:attribute name="newItem" type="Camping_Item__c"
                    default="{'sobjectType' : 'Camping_Item__c',
                               'Quantity__c' : 0,
                               'Price__c' : 0}"/>
  <!-- BOXED AREA -->
  <fieldset class="slds-box slds-theme--default slds-container--small">
    <legend id="newCampItemForm" class="slds-text-heading--small
      slds-p-vertical--medium">
      Add Camping Item
    </legend>
    <!-- CREATE NEW CAMPING 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="campItemName" label="Camping Item 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 CAMPING ITEM FORM -->
  </fieldset>
        <div class ="slds-card slds-p-top--meduim">
        <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="item">
                    <c:campingListItem item="{!item}"/>
                </aura:iteration>
            </div>
        </section>
    </div>
    <!-- i do not think this html is needed any longer
 <ol> 
        <li>Bug Spray</li>
        <li>Bear Repellant</li>
        <li>Goat Food</li>
    </ol>-->
</aura:component>


(campingListController.js)

({
 
    doInit  : function(component, event, helper) {
  var action = component.get("c.getItems");
        action.setCallback(this, function(response){
            var state = response.getState();
          
            if (component.isValid() && state === "SUCCESS") {
          
              
                component.set("v.items", response.getReturnValue());
                
            }
        });
       
        $A.enqueueAction(action);
 },
   
    CreateCamping : function(component, event, helper){
       
        helper.validateFields (component,component.find("name"));
        helper.validateFields (component,component.find("Price"));
        helper.validateFields (component,component.find("Quantity"));
        if(component.get("v.er") === false)
        {    
&nbsp;           //Here I removed the lines and shifted the code to the helperJs      
            console.log('Before:'+Items);           
            helper.CreateCampaign(component,Item);            
             console.log('After:'+Items);                   
        }
 }   
})


(campingListHelper.js)

({
 
    validateFields : function (component,field) {
       
        var nameField = field;
        console.log('yes:'+nameField);
        var expname = nameField.get("v.value");
        if ($A.util.isEmpty(expname)){
           component.set("v.er",true);
           nameField.set("v.errors", [{message:"this field can't be blank."}]);
        }
        else {
            nameField.set("v.errors", null);
        }
    },
   
    CreateCampaign : function (component,Item){
     
        var action = component.get("c.saveItem");
        action.setParams({"CampingItem":Item});
        action.setCallback(this,function(response){
            var state = response.getState();
            if (component.isValid() && state === "SUCCESS") {
                console.log('save');
            }
        });
        $A.enqueueAction(action); 
//Below lines are shifted from controller Js to helperJs
        var Items = component.get("v.items");
&nbsp;       var Item = component.get("v.newItem");
&nbsp;       Items.push(Item);   
        component.set("v.items",Items);
        component.set("v.newItem",{ 'sobjectType': 'Camping_Item__c',
                'Name': '',
                'Quantity__c': 0,
                'Price__c': 0,
                'Packed__c': false });
    }
})

*****************************************************************************************************************************

When I do the Check Challenge, I receive the following error:

Challenge Not yet complete... here's what's wrong:
The Apex controller 'CampingListController' does not exist.

The only thing that I can find in the Forum help documentation is that my code has a campingListController.js and a campingListHelper.js, others have a .js file named camperList.js

Please advise.

Ryan
 
Greetings, I've created my external object for the Data Integration Specalist Superbadge and have configured my external ID as seen below, however, the challenge seems to not pass, indicating that the indirect lookup was not properly created. Here's how I set up the projectRef__c field, which was what I used to push data from the external object into the project object in Salesforce. Are there any steps, I need to take. Hope it helps.
User-added image


User-added image
 
Hi,
the challenge is as follows :

Create a camping component that contains a campingHeader and a campingList component.
1.The campingList component contains an ordered list of camping supplies that include Bug Spray, Bear Repellant, and Goat Food.
2.The campingHeader component contains an H1 heading style with a font size of 18 points and displays 'Camping List'.

so i made a lightening application named "camping.app" having code :

<aura:application >
    <br/><br/><br/>
    <c:campingHeader/>
    <c:campingList/>  
</aura:application>


where lightening component "campingHeader.cmp" having code :

<aura:component >
    <h1> Camping List </h1>
</aura:component>

for I have "campingHeader.css" having code :
.THIS {
}

h1.THIS {
    font-size: 18px;
}

and lightening component "campingList.cmp" having code :

<aura:component >
    <ol>
       <li>Bug Spray</li>
       <li>Bear Repellant</li>
       <li>Goat Food</li>      
    </ol>
</aura:component>

when i preview the application it is working nice; but when checking the challenge it says :
"Challenge Not yet complete... here's what's wrong: 
The 'camping' Lightning Component does not include either the campingHeader or campingList component."

please help me know where I m doing wrong. Thanx waiting for your reply
Hi,

I can't pass the challenge (https://developer.salesforce.com/trailhead/force_com_dev_intermediate/lex_dev_lc_basics/lex_dev_lc_basics_events). This is the error when check challenge:

Challenge Not yet complete... here's what's wrong: 
The campingList JavaScript controller isn't adding the new record to the 'items' value provider.


I tryed in the browser add new Camping Items and it's working correctly. The item is added to database and the list is updated.

This is my code:

campingList Component
<aura:component controller="CampingListController">
    
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    <aura:handler name="addItem" event="c:addItemEvent" action="{!c.handleAddItem}"/>
    
    <div class="slds-page-header" role="banner">

      <div class="slds-grid">

        <div class="slds-col">

          <p class="slds-text-heading--label">Camping Items</p>

          <h1 class="slds-text-heading--medium">My Camping Items</h1>

        </div>

      </div>

    </div>

      
  <div aria-labelledby="newitemform">

      <fieldset class="slds-box slds-theme--default slds-container--small">
    
        <c:campingListForm />
    
      </fieldset>

	</div>
    
    
     <aura:attribute name="items" type="Camping_Item__c[]"/>

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

</aura:component>

campingList Controller.js
({
    
    doInit: function(component, event, helper) {
    
        var action = component.get("c.getItems");
    
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (component.isValid() && state === "SUCCESS") {
                component.set("v.items", response.getReturnValue());
            }
            else {
                console.log("Failed with state: " + state);
            }
        });
    
        $A.enqueueAction(action);
    },    
    
    handleAddItem: function(component, event, helper) {
        var item = event.getParam("item");
                
        var action = component.get("c.saveItem");
        action.setParams({
            "item": item
        });
        
        action.setCallback(this, function(response){
            var state = response.getState();
            if (component.isValid() && state === "SUCCESS") {        
                var theItems = component.get("v.items");
                theItems.push(item);
                component.set("v.items",theItems);
            }
        });
        $A.enqueueAction(action);
    }
    
})

CampingListController
public with sharing class CampingListController {

    @AuraEnabled 
    public static List<Camping_Item__c> getItems() {
        return [SELECT Id, Name, Price__c, Quantity__c, Packed__c FROM Camping_Item__c];
    }
    
    @AuraEnabled
    public static Camping_Item__c saveItem(Camping_Item__c item) {
        upsert item;
        return item;
    }
}

CampingListForm Component
<aura:component >
    
     <aura:attribute name="newItem" type="Camping_Item__c"
     default="{ 'sobjectType': 'Camping_Item__c',
                    'Name': '',
                    'Packed__c': false,
                    'Price__c': '0',
                    'Quantity__c': '0' }"/>
	<aura:registerEvent name="addItem" type="c:addItemEvent"/>
    
  <div aria-labelledby="newitemform">
      <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>
    
        <form class="slds-form--stacked">
    
          <div class="slds-form-element slds-is-required">
              <div class="slds-form-element__control">
                  <ui:inputText aura:id="name" label="Camping Item Name"
                      class="slds-input"
                      labelClass="slds-form-element__label"
                      value="{!v.newItem.Name}"
                      required="true"/>
              </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">
              <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">
              <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}"/>
    
              </div>
          </div>
    
          <div class="slds-form-element">
              <ui:button label="Create Camping Item"
                  class="slds-button slds-button--brand"
                  press="{!c.clickCreateCampingItem}"/>
          </div>
    
        </form>
    
      </fieldset>
</div>

</aura:component>

CampingListForm Controller.js
({    
    
    clickCreateCampingItem : function(component, event, helper) {
        
        var validCamping = true;

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

        
        var priceField = component.find("price");
        var price = priceField.get("v.value");
        if ($A.util.isEmpty(price) || isNaN(price) || (price <= 0.0)){
            validCamping = false;
            priceField.set("v.errors", [{message:"Camping Item price can't be blank."}]);
        }
        else {
            priceField.set("v.errors", null);
        }
        
        var quantityField = component.find("quantity");
        var quantity = quantityField.get("v.value");
        if ($A.util.isEmpty(quantity) || isNaN(quantity) || (quantity <= 0)){
            validCamping = false;
            quantityField.set("v.errors", [{message:"Camping Item quantity can't be blank."}]);
        }
        else {
            quantityField.set("v.errors", null);
        }

        if(validCamping){
            
            helper.createItem(component);
            
        }
        
    },
})

CampingListForm Helper.js
({
    
     createItem : function(component) {
        var newItem = component.get("v.newItem");
        var addEvent = component.getEvent("addItem");
        addEvent.setParams({"item" : newItem});
        addEvent.fire();
        component.set("v.newItem",
                     { 'sobjectType': 'Camping_Item__c',
                    'Name': '',
                    'Packed__c': false,
                    'Price__c': 0,
                    'Quantity__c': 0});
    }
})

Could anyone help me?

Thanks,
Regards.
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);
        
        }
    }
})

 
Hi, I am having trouble with the "Attributes and Expressions" module from trailhead.

Here is the challenge:
Create a Lightning Component to display a single item for your packing list.
  • Create a component called campingListItem that displays the name (ui:outputText) and the three custom fields using the appropriate output components.
  • Add an attribute named 'item' for type Camping_Item__c.
I created an component named campingListItem and this is the code:
<aura:component >
    <aura:attribute name="item" type="<my_domain>__Camping_Item__c"/>
    
    <ui:outputText value="{!v.item.Name}"/>
    <ui:outputCheckbox value="{!v.item.<my_domain>__Packed__c}"/>
    <ui:outputCurrency  value="{!v.item.<my_domain>__Price__c}"/>
    <ui:outputNumber value="{!v.item.<my_domain>__Quantity__c}"/>
</aura:component>

The error that I am getting is: "Challenge Not yet complete... here's what's wrong: 
The packingListItem Lightning Component's attribute tag doesn't exist or its attributes are not set correctly."

With this, I tried to create another component, with the name "packingListItem", but It didn't work.

Can anyone help me?

Thanks,
I'm new to salesforce, can you please tell me rough idea that how can I implement pagination?
Hello Dears,

Please let me know how to implement Pagination with Standard Controller and Extension used in Apex:Page.
Kindly assist on this.


Thanks,
Rohit Sharma

Hi,

If we have constructor in a class,Kindly let me know how can we write code to cover that constructor in test method?

 

Thanks ,

Eswar.

hi, i have created an lwc component. when i am trying to deploy it into org it is showing  XML parse error: Unexpected xml:   .
User-added imagethis is my XML file.

when if removing <targets> tag ...then the component is getting deployed.

did anybody face this issue?
pls help..
Greetings, I cannot seem to get this to work. I have my var set to cs, as it only works with that, rather, as I attempt to set it, I get the error message of var not set correctly. Please advise. Here's the code. The apex code appears correct.

<apex:page controller="NewCaseListController">
    <apex:form >
        <apex:pageBlock title="Case List" id="Case_list">
         <apex:repeat value="{!NewCases}" var="cs">
         <table style="width:1000px;">
          
<tr>
 <apex:repeat value="{!NewCases}" var="cs">
        <apex:outputLink value="https://na16.salesforce.com/{!cs.Id}">{!cs.CaseNumber}</apex:outputLink>
         <apex:outputLink value="{!cs.CaseNumber}">{!cs.CaseNumber}</apex:outputLink>
        </apex:repeat> 
             </tr>
        </table>
             </apex:repeat>
        </apex:pageBlock>
    </apex:form>
</apex:page>