• AnuSFDCDevloper
  • NEWBIE
  • 5 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies
Though i create the fields as follow, am getting the error at Data Integration Specialist SuperBadge Challenge#9

billAmount
BillDate
InvoicesId
OpportunityId
projectRef
Lightning Components Basics
Connect Components with Events

I'm facing with the below issue.

The campingList component appears to be using UI Components instead of Base Lightning Components in the form. You should be using only Base Lightning Components in CampingList : Connect Components with Events

Below is my CampingList Component Codes.

campingList.cmp
-------------------------


<aura:component controller="CampingListController" >
    
    <aura:attribute name="items" type="Camping_Item__c[]"/>
    
    <aura:handler name="init" action="{!c.doInit}" value="{!this}" />  
    <aura:handler name="addItem" event="c:addItemEvent" action="{!c.handleAddItem}"/>   
    
    
    <!-- Page Header -->
    <div class="slds-page-header" role="banner" >
        <div class="slds-grid">
            <div class="slds-col" >
                <h1 class="slds-text-heading--medium">Camping List</h1>
            </div>
        </div>
    </div>  
    <!--/ Page Header -->
    
    <!-- New Camping Form -->
        <c:campingListForm />
    <!--/ New Camping Form -->
    
    <!-- Camping List Items -->      
    <aura:iteration items="{!v.items}" var="itm">
          <c:campingListItem item="{!itm}"/><br/>
    </aura:iteration>
    <!--/ Camping List Items -->   
    
</aura:component>

CampingListController.js
-------------------------------------


({
        
    //-- Load Camping list Items.
    doInit: function(component,event,helper)    
    {
        //-- Create the Action.
        var action = component.get("c.getItems");
        
        //-- Add callback behavior for when response is received.
        action.setCallback(this,function(response)
        {
            var state = response.getState();
            if(component.isValid() && state === "SUCCESS")
            {
                component.set("v.items",response.getReturnValue());
                console.log("doInit: "+response.getReturnValue());
            }
        });
        
        //-- Send action off to be execute.
        $A.enqueueAction(action);
    },
    
     //-- Handle Create Expense Actions..
    handleAddItem: function(component, event, helper)
    {
        console.log("\nEntry into CampingListController.js -> handleAddItem()");        
        
        var item = event.getParam("item");
        console.log("\nCampingListController.js -> handleAddItem() item: "+ JSON.stringify(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 items = component.get("v.items");
               console.log("Campaigns(items..) before  create: "+JSON.stringify(items));
               items.push(response.getReturnValue());
               console.log("Campaigns(items..) after  create: "+JSON.stringify(items));
               component.set("v.items",items);
            }
        });
        $A.enqueueAction(action);
    }

 
    
})

campingListForm.cmp
---------------------------------


<aura:component controller="CampingListController" >
    
    <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"/>
    
    
    <!-- New Camping Form-->  
    <div class="slds-col slds-col--padded slds-p-top--large" >  
           <!-- Boxed Area-->
        <fieldset class="slds-box slds-theme--default slds-container--small">
            
            <legend id="newexpenseform" class="slds-text-heading--small" >
                Add Camping List
            </legend>
            
            <!-- Create New Expense Form -->
            <form class="slds-form--stacked">
                <!-- Name -->
                <div class="slds-form-element slds-is-required" >
                    <div class="slds-form-element__control" >
                        <ui:inputText aura:id="name"  label="Camping Name" class="slds-input"
                                      labelClass="slds-form-element__label" value="{!v.newItem.Name}" required="true" />
                    </div>
                </div>
                
                
                <!-- Quantity -->
                <div class="slds-form-element__label" >
                    <div class="slds-form-element__control" >
                        <ui:inputText aura:id="quantity" label="Quantity" class="slds-input"
                                      labelClass="slds-form-element__label" value="{!v.newItem.Quantity__c}" />
                    
                    </div>                
                </div>
                
                <!-- Price -->
                <div class="slds-form-element slds-is-required" >
                    <div class="slds-form-element__control" >
                        <ui:inputNumber aura:id="price" label="Price" class="slds-input"
                                        labelClass="slds-form-element__label" value="{!v.newItem.Price__c}" required="true" />
                    
                    </div>
                </div>
                
                <!-- Packed -->
                <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>
                
                <!-- Button Create Expense -->
                <div class="slds-form-element">
                    <ui:button label="Create Campaign" class="slds-button slds-button--brand" press="{!c.clickCreateItem}"  />
                </div>
                
            </form>            
            <!--/ Create New Expense Form -->
        </fieldset>
          <!--/ Boxed Area-->        
    </div>
    <!--/ New Camping Form-->  
    
</aura:component>

campingListFormController.js
------------------------------------------


({
    clickCreateItem : function(component, event, helper)
    {
        //-- Simplistic error checking.
        console.log("\nIn CampingListFormController.js -> submitForm()");
        var validCampign = true;
        
        //-- Name must not be blank.
        var nameField     = component.find("name");
        var campaignname = nameField.get("v.value");
        if($A.util.isEmpty(campaignname))
        {
             validCampign = false;
            nameField.set("v.errors",[{message: "Camping name can't be blank."}]);     
        }
        else
        {
            nameField.set("v.errors",null);
        }

        //-- Quantity must not be blank.
        var qtyField = component.find("quantity");
        var quantity = qtyField.get("v.value");
        if($A.util.isEmpty(quantity))
        {
            validCampign = false;
            qtyField.set("v.errors",[{message: "Quantity can't be blank."}]);
        }
        else
        {
            qtyField.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))
        {
            validCampign = false;
            priceField.set("v.errors",[{message: "Price can't be blank."}]);
        }
        else
        {
            priceField.set("v.errors",null);            
        }
        
        //-- If we pass error checking, do some real work.
        if(validCampign)
        {
            //-- Create the new expense.
            var newCampaign = component.get("v.newItem");
            console.log("In CampingListFormController.js -> submitForm()\n The Item: " + JSON.stringify(newCampaign));
            helper.createItem(component, newCampaign);
        }               
         
        
        
    }
    
})

campingListFormHelper.js
--------------------------------------


({
    createItem : function(component,item)
    {    
        console.log("\nEntry into CampingListFormHelper.js -> createItem()");
        console.log("In CampingListFormHelper.js -> createItem() the item is: "+JSON.stringify(item));
        var createEvent = component.getEvent("addItem");        
        createEvent.setParams({ "item": item });
        createEvent.fire();        
        component.set("v.newItem",{'sobjectType':'Camping_Item__c','Name': '','Quantity__c': 0,'Price__c': 0,'Packed__c': false});
    }
})

CampingListController.apxc
----------------------------------------


public with sharing class CampingListController
{
    @AuraEnabled
    public static List<Camping_Item__c> getItems()
    {
        String[] fieldsToCheck = new String[]{'Id','Name','Packed__c','Price__c','Quantity__c'};
        Map<String,Schema.SObjectField> fieldDescribeTokens = Schema.SObjectType.Camping_Item__c.fields.getMap();
        
        for(String field : fieldsToCheck)
        {
            if(!fieldDescribeTokens.get(field).getDescribe().isAccessible())
            {
                throw new System.NoAccessException();
                return null;
            }            
        }        
        return [SELECT Id,Name,Packed__c,Price__c,Quantity__c FROM Camping_Item__c];
    }
    
    
    @AuraEnabled  
    public static Camping_Item__c saveItem(Camping_Item__c item)
    {    
        System.debug('Campaign List Item from Apex: '+item);
        upsert item;
        System.debug('Campaign List Item from Apex Id: '+item.Id);
        return item;
    }
        
}

addItemEvent.evt
-------------------------


<aura:event type="COMPONENT">
    <aura:attribute name="item" type="Camping_Item__c"/>
</aura:event>

Please suggest me where im missing.

Thanks.
Ravichand.






 
Hello guys,

I am getting the below errow then trying to complete one of the modules: Lightning Components Basics, Input data using forms

Challenge Not yet complete... here's what's wrong: 
The campingList component doesn't appear to have a Packed checkbox field in the form using a Lightning Base component.

Although i am using the base lightning comp:
                        
<lightning:input type="checkbox"
                                         aura:id="campaingItem"
                                         label="Packed"
                                         name="campaignPacked"
                                         value="{!v.newItem.Packed__c}"                                        
                                         />

Please help

 
I am not able to get through this challenge. 
I logged in through SOAPUI and used the session id to create an account. The account gets created and returns success. However when I try to validate the challenge in trailhead, it gives me an error - 

Challenge Not yet complete... here's what's wrong: 
It doesn't appear that you have logged in using SoapUI.

I am not sure what did I miss out.
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,