• rahul seth 6
  • 4 Points
  • Member since 2016

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 1
My code is as follows:
trigger LatestCreatedDate on Task (after insert,after update) {

        TriggerHandler objTriggerHandler = new TriggerHandler();
        if( trigger.isInsert){
            objTriggerHandler.onAfterUpdate(trigger.new , trigger.old);

Handler class code:
public class TriggerHandler{
    List<DateTime> lstDateTime = new List<DateTime>();
    public void onAfterInsert(List<Task> lsttsk)
     Set<Id> setId=new Set<Id>();
     for(Task objtask : lsttsk)
     List<Account> lstAccount=[Select Id,Recently_Added_Task_Date__c,(Select Id,LastModifiedDate FROM Tasks Order by LastModifiedDate desc Limit 1) From Account WHERE Id IN: setId];
       for(Account objAccount : lstAccount)
           for(Task objtas : objAccount.Tasks)
           objAccount.Recently_Added_Task_Date__c = objtas.LastModifiedDate;

       }update lstAccount;

Challenge - 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 answer - 
<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}"/>
        <ui:inputText value="{!v.newitem.name}"/>
        <ui:inputCheckbox value="{!v.newitem.Packed__c}"/>
        <ui:inputCurrency value="{!v.newitem.Price__c}"/>
        <ui:inputNumber value="{!v.newitem.Quantity__c}"/>

Error -

Challenge Not yet complete... here's what's wrong: 
The campingList component isn't iterating the array of 'items' and creating 'campingListItem' components.

Please share the correct solution.