• vleandro
  • NEWBIE
  • 85 Points
  • Member since 2013
  • Lead Solutions Engineer
  • Salesforce

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 20
    Questions
  • 31
    Replies
Hi,

I am facing below error while trying to verify Step 8-
Error: Please ensure that product2Extension and its methods are still working as specified in the earlier challenge.

Code below:
public class Product2Extension {

    public List<ProductWrapper> productsToInsert {get;set;}

    public Product2Extension(ApexPages.StandardController controller){
        productsToInsert = new List<ProductWrapper>();
        addRows();
    }
    
    public List<SelectOption> GetFamilyOptions() {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption(Constants.SELECT_ONE, Constants.SELECT_ONE));
        for(PickListEntry eachPicklistValue : Constants.PRODUCT_FAMILY) {
            options.add(new SelectOption(eachPicklistValue.getValue(), eachPicklistValue.getLabel()));
        }
            return options;
    }
    
    public void AddRows(){
        for (Integer i=0; i<Constants.DEFAULT_ROWS; i++ ){
            productsToInsert.add(new ProductWrapper());
        }
    }

    public List<ChartHelper.ChartData> GetInventory(){
        return ChartHelper.GetInventory();
    }

    public PageReference Save(){
        SavePoint sp = Database.setSavepoint();
        Integer insertedCount = 0;
        try {
            List<Product2> newProducts = new List<Product2>();
            List<PriceBookEntry> pbeList = new List<PriceBookEntry>();
            List<ProductWrapper> filteredProductWrappers = new List<ProductWrapper>();
            for(ProductWrapper eachPW : productsToInsert) {
                if(!String.isBlank(eachPW.productRecord.Name) && !String.isBlank(eachPW.productRecord.Family) && 
                   eachPW.productRecord.Family!=Constants.SELECT_ONE && eachPW.productRecord.isActive &&
                   eachPW.pricebookEntryRecord.UnitPrice!=null && eachPW.productRecord.Initial_Inventory__c!=null && 
                   eachPW.productRecord.Initial_Inventory__c!=0 && eachPW.pricebookEntryRecord.UnitPrice!=0) {
                       filteredProductWrappers.add(eachPW);
                   }                
            }
            for(ProductWrapper eachPW : filteredProductWrappers) {
                newProducts.add(eachPW.productRecord);
            }
            Database.SaveResult[] productSaveResults = Database.insert(newProducts, false);
            for(Integer i=0; i<productSaveResults.size(); i++) {
                if(productSaveResults[i].isSuccess()) {
                    PriceBookEntry pbe = filteredProductWrappers[i].pricebookEntryRecord;
                    pbe.Product2Id = productSaveResults[i].getId();
                    pbe.IsActive = true;
                    pbe.Pricebook2Id = Constants.STANDARD_PRICEBOOK_ID;
                    pbeList.add(pbe);
                    insertedCount++;
                }
            }
            Database.SaveResult[] pbeSaveResults = Database.insert(pbeList, false);
            
            //If successful clear the list and display an informational message
            apexPages.addMessage(new ApexPages.message(ApexPages.Severity.INFO,insertedCount + ' Inserted'));
            productsToInsert.clear();   //Do not remove
            addRows();  //Do not remove
        } 
        catch (Exception e){
            System.debug('Exception occured:'+e.getMessage());
            Database.rollback(sp);
            apexPages.addMessage(new ApexPages.message(ApexPages.Severity.ERROR, Constants.ERROR_MESSAGE));            
        }
        return null;
    }
    
    public class ProductWrapper {
        public Product2 productRecord {get;set;}
        public PriceBookEntry pricebookEntryRecord {get;set;}
        
        public ProductWrapper() {
            productRecord = new Product2();
            pricebookEntryRecord = new PricebookEntry();
        }
    }
}
Doing the Build Flexible Apps with Lightning Components proyect, in step 2 (Use Base Lightning Components) I got a error: "Make sure the 'SimilarProperties' component has been added to the Property Record page", but I already added the component to the only Lightning record Page and activated it.   Anyone can help me? .
Trailhead Superbadge:  Lightning Experience Rollout Specialist, Challenge 7

I get the following error:
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: FUGRLDMP

I've done the following:
1.  This is a brand new Trailhead Org that was setup specifically for this Superbadge.  
2.  I have tried logging out of both the Org and Trailhead.  No impact.  Same error.
3.  I tried renaming The "Sales Operations" Dashboard to be just "Sales" and then clicked on Check Challenge.  The Challenge correctly identified that the Dashboard "Sales Operations" does not exist.  I renamed the Dashboad back to "Sales Operations" and get the above error.

Thoughts or suggestions?

Thank you for your time!
Virginia
I'm having problems getting the sample code within the Trailhead to work.  Specifically the code for ldsSaveRecord.cmp.  This is exactly what the code is that was provided, however, when I try and save the component, I get the following error:

FIELD_INTEGRITY_EXCEPTION
Failed to save undefined: The attribute "required" was not found on the COMPONENT markup://ui:outputText: Source

Any ideas on what the problem might be?   Thank you for your time and thoughts!
 
<aura:component implements="flexipage:availableForRecordHome, force:hasRecordId"> <!--inherit recordId attribute-->

<aura:attribute name="record" type="Object" />
<aura:attribute name="simpleRecord" type="Object" />
<aura:attribute name="recordError" type="String" />

<force:recordData aura:id="recordEditor"
    layoutType="FULL"
    recordId="{!v.recordId}"
    targetError="{!v.recordError}"
    targetRecord="{!v.record}"
    targetFields ="{!v.simpleRecord}"
    mode="EDIT" />

    <!-- Display a header with details about the record -->
    <div class="slds-form--stacked">
        <div class="slds-form-element">
            <label class="slds-form-element__label" for="recordName">Name: </label>
            <div class="slds-form-element__control">
              <ui:outputText class="slds-input" aura:id="recordName"
                value="{!v.simpleRecord.Name}" required="true"/>
            </div>
        </div>
    </div>

    <!-- Display Lightning Data Service errors, if any -->
    <aura:if isTrue="{!not(empty(v.recordError))}">
        <div class="recordError">
            <ui:message title="Error" severity="error" closable="true">
                {!v.recordError}
            </ui:message>
        </div>
    </aura:if>

    <!-- Display an editing form -->
    <lightning:input aura:id="recordName" name="recordName" label="Name"
                  value="{!v.simpleRecord.Name}" required="true"/>

     <lightning:button label="Save Record" onclick="{!c.handleSaveRecord}"
               variant="brand" class="slds-m-top--medium"/>
</aura:component>

 
I noticed that there is no link in this Trailhead for OpenSSL for Windows.  It simpy says "Windows complete package.exe installer" with no link. What's the suggestion or recommendation for those of us on Windows?

Thank you.
There seems to be an issue in this trailhead module when running it on Windows. Unencrypting the encrypted server key on the Travis server doesn't work.
This seems to be a known issue (https://github.com/travis-ci/travis-ci/issues/4746) and this alternative (https://docs.travis-ci.com/user/encrypting-files/#Using-OpenSSL) didn't work for me as well.
I'm seeing this when running my canvas app on a custom tab (via a visual force page) installed managed package. I've had no issues running it the same way on the same enviroment without it being a managed package as I was developing. Any idea?
Errors in the logs
 
Can somebody please help me out here how to measure based on the sum of # instead of a count of rows or sum of the amount because on my case # is not appearing on the creating lens window Thanks in advance. PFB more details.

User-added image
Hello everyone, I'm getting confused on this module for the mobile section... the directions state to build the lens as follows:
  • Dataset: DTC Opportunity
  • Add Group: Opportunity Owner
  • Change Measure: Count of Rows to Sum of Amount
  • Sort by: Dsc (Descending)
  • Filter by: Industry Equals Engineering
  • Filter by: Won Equals True
  • Chart Type: Horizontal Bar
  • Lens Name: Top Engineering Sales
  • App: My Exploration
I have my criteria setup as follows:

User-added image
User-added imageUser-added imageUser-added imageUser-added image

I am just not sure where I am going wrong!  I've tried deleting it and reconstructing it, but every time I get the error "Challenge Not yet complete... here's what's wrong: The 'Top Engineering Sales' lens does not appear to have the correct query. Please check the requirements and ensure everything is setup correctly."

Any help would be appreciated!
I've searched the forums high and low and I'm still not getting something right with this.  

My form loads and loads my records from the database.  The problem is when I try and go to "Create Camping Item" I get this error:

This page has an error. You might just need to refresh it. Action failed: c$campingList$controller$createCampingList [component is not defined] Failing descriptor: {c$campingList$controller$createCampingList}

Here's the code:

campingList.cmp
<aura:component controller="CampingListController">
    
    <aura:attribute name="items" type="Camping_Item__c[]"/>
    
    <aura:attribute name="newItem" type="Camping_Item__c" default="{'Name':'',
                                                                   'Quantity__c':0,
                                                                   'Price__c':0,
                                                                   'Packed__c':false,
                                                                   'sobjectType':'Camping_Item__c'}"/>
    
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    
    <!-- NEW Campaing FORM -->
    <div class="slds-col slds-col--padded slds-p-top--large">
        
        
        <!-- [[ Campaing form goes here ]] -->
        
        <div aria-labelledby="newCampaingForm">
            
            <!-- BOXED AREA -->
            <fieldset class="slds-box slds-theme--default slds-container--small">
                
                <legend id="newCampaingForm" class="slds-text-heading--small 
                                                   slds-p-vertical--medium">
                    Add Expense
                </legend>
                
                <!-- CREATE NEW Campaing FORM -->
                <form class="slds-form--stacked">
                    
                    <div class="slds-form-element slds-is-required">
                        <div class="slds-form-element__control">
                            <ui:inputText aura:id="campingName" label="Camping 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.createCampingList}"/>
                    </div>
                    
                </form>
                <!-- / CREATE NEW EXPENSE FORM -->
                
            </fieldset>
            <!-- / BOXED AREA -->
            
        </div>
        <!-- / CREATE NEW EXPENSE -->
    </div>
    
    <!-- ITERATIING ITEM LISTS -->
    <div class="slds-card slds-p-top--medium">
        
        <c:campingHeader />
        
        <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>	
    <!-- / ITERATIING ITEM LISTS -->
 
    
</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);
	},
    
    createCampingList : function(component, event, helper){
    	// If we pass error checking, do some real work
        if(helper.validateCampingForm(component)) {
            var newItem = component.get("v.newItem");
            helper.createItem(component, newItem);
        }
    }
})

campingListHelper.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);
	},
    
    createCampingList : function(component, event, helper){
    	// If we pass error checking, do some real work
        if(helper.validateCampingForm(component)) {
            var newItem = component.get("v.newItem");
            helper.createItem(component, newItem);
        }
    }
})

and last but not least, my Apex class, CampingListController.apxc
public with sharing class CampingListController {
    
    @AuraEnabled
    public static List<Camping_Item__c> getItems() {
        String[] fieldsToCheck = new String[] {
            'Id', 'Name', 'Quantity__c', 'Price__c', 'Packed__c', 'CreatedDate'};

        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;
            }
        }
                
        //OK, they're cool, let 'em through
        return [SELECT Id, Name, Quantity__c, Price__c, Packed__c, CreatedDate FROM Camping_Item__c];
                
    }
    
    @AuraEnabled
    public static Camping_Item__c saveItem(Camping_Item__c item) {
        upsert item;
        return item;
    }

}

For the life of me I can't seem to figure out what is missing.  Any and all help will be deeply appreciated.  Thank you for your time!




 
I'm following the sample code in this particular Trailhead.   I've even "copied" the code itself, and still when I go into Preview and try and create an expense; nothing happens.  No data is being posted back to Expense__c.

Even the debug shows the data is getting captured

User-added image

If that's hard to read its:
Create expense: {"sobjectType":"Expense__c","Name":"Test","Amount__c":100,"Client__c":"ABC","Date__c":"2016-11-02","Reimbursed__c":false}
components/c/expenses.js:44 Expenses before 'create': []
components/c/expenses.js:47 Expenses after 'create': [{"sobjectType":"Expense__c","Name":"Test","Amount__c":100,"Client__c":"ABC","Date__c":"2016-11-02","Reimbursed__c":false}]

I've got to be missing something somewhere.

Here's the code:

expensesApp.app
<aura:application extends="force:slds">
    
    <!-- This component is the real "app -->
    <c:expenses /> 
	
</aura:application>

expenses.cmp
<aura:component >
	
    <aura:attribute name="expenses" type="Expense__c[]"/>
    
    <aura:attribute name="newExpense" type="Expense__c"
     default="{ 'sobjectType': 'Expense__c',
                    'Name': '',
                    'Amount__c': 0,
                    'Client__c': '',
                    'Date__c': '',
                    'Reimbursed__c': false }"/>
    
    <!-- PAGE HEADER -->
    <div class="slds-page-header" role="banner">
    	<div class="slds-grid">
        	<div class="slds-col">
            	<p class="slds-text-heading--label">Expenses</p>
                <h1 class="slds-text-heading--medium">My Expenses</h1>
            </div>
        </div>
    </div>
    <!-- / PAGE HEADER -->
    <div class="slds-col slds-col--padded slds-p-top--large">
    
        <div aria-labelledby="newexpenseform">
        
            <!-- BOXED AREA -->
            <fieldset class="slds-box slds-theme--default slds-container--small">
            
                <legend id="newexpenseform" class="slds-text-heading--small slds-p-vertical--medium">
                	Add Expense
                </legend>
                
                <!-- CREATE NEW EXPENSE FORM -->
                <form class="slds-form--stacked">
                
                    <div class="slds-form-element slds-is-required">
                    	<div class="slds-form-element__control">
                        	<ui:inputText aura:id="expname" label="Expense Name" 
                            	class="slds-input" 
                                labelClass="slds-form-element__label"
                                value="{!v.newExpense.Name}"
                                required="true" />
                        </div>
                    </div>
                    
                    <div class="slds-form-element slds-is-required">
                    	<div class="slds-form-element__control">
                        	<ui:inputNumber aura:id="amount" label="Amount"
                            	class="slds-input"
                                labelClass="slds-form-element__label"
                                value="{!v.newExpense.Amount__c}"
                                required="true" />
                        </div>
                    </div>
                    
                    <div class="slds-form-element">
                    	<div class="slds-form-element__control">
                        	<ui:inputText aura:id="client" label="Client"
                            	class="slds-input"
                                labelClass="slds-form-element__label"
                                value="{!v.newExpense.Client__c}"
                                placeholder="ABC Co." />
                        </div>
                    </div>
                    
                    <div class="slds-form-element">
                    	<div class="slds-form-element__control">
                        	<ui:inputDate aura:id="expdate" label="Expense Date"
                            	class="slds-input"
                                labelClass="slds-form-element__label"
                                value="{!v.newExpense.Date__c}"
                                displayDatePicker="true" />
                        </div>
                    </div>
                    
                    <div class="slds-form-element">
                    	<ui:inputCheckbox aura:id="reimbursed" label="Reimbursed?"
                        	class="slds-checkbox"
                            labelClass="slds-form-element__label"
                            value="{!v.newExpense.Reimbursed__c}" />
                    </div>
                    
                    <div class="slds-form-element">
                    	<ui:button label="Create Expense"
                        	class="slds-button slds-button--brand"
                            press="{!c.clickCreateExpense}" />
                    </div>
                    
                </form>
                <!-- / CREATE NEW EXPENSE FORM -->
                
            </fieldset>
            <!-- / BOXED AREA -->
        </div>
    </div>
    <!-- / NEW EXPENSE FORM -->
    
</aura:component>

expensesController.js
({
    clickCreateExpense: function(component, event, helper) {

        // Simplistic error checking
        var validExpense = true;

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

        // ... hint: more error checking here ...

        // If we pass error checking, do some real work
        if(validExpense){
            // Create the new expense
            var newExpense = component.get("v.newExpense");
            console.log("Create expense: " + JSON.stringify(newExpense));
            helper.createExpense(component, newExpense);
        }
    }
})

expensesHelper.js
({
    createExpense: function(component, expense) {
        var theExpenses = component.get("v.expenses");
 
        // Copy the expense to a new object
        // THIS IS A DISGUSTING, TEMPORARY HACK
        var newExpense = JSON.parse(JSON.stringify(expense));
 
        console.log("Expenses before 'create': " + JSON.stringify(theExpenses));
        theExpenses.push(newExpense);
        component.set("v.expenses", theExpenses);
        console.log("Expenses after 'create': " + JSON.stringify(theExpenses));
    }
})

Thanks to all. 
I have a class that currently does a great job of getting a Queue and then listing all the users for that queue.  Code works great.  I present the query snippit here for reference.
 
// provide queue name to show on page
    public Group selectedQueue {
        get {
            return [
				SELECT
                	id, name
                FROM
                	group
                WHERE
                	id = :queueId
            ];
        }
    }
    
    // list of all active queue members
    public List<User> queueMembers {
        get {
            return [
            	SELECT
                	id, firstName, lastName, username, email, userRole.name, profile.name
                FROM
                	user
                WHERE
                	id IN (SELECT userOrGroupId FROM groupmember WHERE groupId = :queueId )
				AND
               	isActive = true
                ORDER BY firstName ASC                	
            ];
        }
    }

My visualforce page presents the user with the Queue they selected and the users who are members of that Queue (along with their attributes such as name, profile, role, etc.).

Now I want to bring in those users' permission sets.  

I know I can do a SELECT statement against the PermissionSetAssignment object:
 
SELECT Assignee.Name, Assignee.ID, PermissionSet.Label
FROM PermissionSetAssignment
WHERE PermissionSet.IsOwnedByProfile = FALSE

However, I'm struggling with how to build this into the query I have above.  I'm a fairly new developer so any assistance or suggestions would be greatly appreaciated!

Thank you!
Virginia

 

Hi All,

In attempting to compile the first test class provided in the 'Explore Custom Transaction Security Policies' module, I receive 2 compile errors.

The first was around line 29, where the semi colon beside eventData needs to be moved outside of the right parenthesis.

However after trying to compile after that change there is another error complaining that the platform field of the LoginHistory object (declared as loginHistoryObj for our instance) is not writeable.  Below are the lines of importance...

    /* Create a history object that has Platform = Android 4. */
    LoginHistory loginHistoryObj = new LoginHistory();
    loginHistoryObj.Platform = 'Android 4';  <----
this is where the compile is complaining (Error: Compile Error: Field is not writeable: LoginHistory.Platform at line 7 column 5)

I checked the LoginHistory Object documentation, and it looks like it should be writeable to me.

Does anyone have any suggestions? or is this a bug of some sort?

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.
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 would like to create a flow to send an email template to multiple recipients. I have created 2 custom objects and the custom email template which includes data from these custom objects.

 

Object 1: Parent

Object 2: Child

 

The Child object has a lookup relationship with Contacts.

 

I would like to add a button to the Parent object's page layout, which when clicked, executes the flow.

 

The flow would cycle through all of the Child objects for that Parent and send the populated email template to Contact's email for each Child.

 

Can I do this? Does anyone have an example that they can share or recommend some reading on how to do such a thing?