• TimCarl
  • NEWBIE
  • 20 Points
  • Member since 2018
  • Salesforce Administrator [Certified ]

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 6
    Replies
Is there a built-in component attribute in any of the namespaces, (ie., lightning:, ui:, or force:, that has a search or lookup functionality to the Contact object record. The field I am working is in a lightning component, within a "form" component attribute.  

Here is a snapshot of the form component in top-level component. 

User-added image

This is a snapshot the custom field 'data type'

User-added image


The app works except when I enter data into the 'Client' field it will not save and create record.

Snapshot of my design.
User-added image

 
<aura:component controller="ExpensesController" >  

    <!--aura:attribute for the component -->
	<aura:attribute name="newExpenses" type="Expense__c" />
    
    <!--A component registers that it may fire an event 
        by using <aura:registerEvent> in its markup. -->
    
    <aura:registerEvent name="updateExpense" type="c.expensesItemUpdate"/>
    
	<aura:attribute name="newExpense" type="Expense__c"
         		          default="{'sobjectType': 'Expense__c',
                                  'Name': '',
                                  'Amount__c': 0,
                                  'Client__c': '',
                                  'Date__c': '',
                                  'Reimbursed__c': false }" />
    
    <aura:attribute name="expenses" type="Expense__c[]" />
    
    
    
        <!-- handles the "init event" which is the action, {!c.doInit} -->
	<aura:handler name="init" action="{!c.doInit}" value="{!this}" />
     
       <!--action handler controller in this component: JS -->
       <aura:handler name="updateExpense" event="c:expensesItemUpdate"
        action="{!c.handleUpdateExpense}"/>

    
 <!-- PAGE HEADER -->
    <lightning:layout class="slds-page-header slds-page-header--object-home">
        <lightning:layoutItem>
            <lightning:icon iconName="standard:scan_card" alternativeText="MyExpenses"/>
        </lightning:layoutItem>
        <lightning:layoutItem class="container" padding="horizontal-small">
            <div class="page-section page-header">
                <h1 class="slds-text-heading--label">Expenses</h1>
                <h2 class="slds-text-heading--medium">My Expenses</h2>
            </div>
        </lightning:layoutItem>
    </lightning:layout>
<!-- / PAGE HEADER END -->
    
    
    <!-- NEW EXPENSE FORM -->
    	<lightning:layout>
        <lightning:layoutItem flexibility="auto" padding="around-small" size="6">
            
    <!-- The div for the form: CREATE NEW EXPENSE -->
    	<div aria-labelledby="newexpenseform">
        
    <!-- Fieldset: BOXED AREA -->
        <fieldset class="slds-box slds-theme--default slds-container--small">
        <legend id="newexpenseform" class="slds-text-heading--medium 
          	slds-p-vertical--medium">
          	Add Expense
        </legend>
  
            
        <!-- Form: CREATE NEW EXPENSE FORM -->
            
        <form class="slds-form--stacked  slds-input">          
            <lightning:input aura:id="expenseform" placeholder="Expense type"   
              label="Expense"
                             name="expensename"
                             value="{!v.newExpense.Name}"
                             required="true"/> 
            
            <lightning:input type="number" aura:id="expenseform" label="Amount"
                             name="expenseamount"
                             min="0.1"
                             formatter="currency"
                             step="0.01"
                             value="{!v.newExpense.Amount__c}"
                             messageWhenRangeUnderflow="Enter an amount that's at least 
                            $0.10."/>
           
            <lightning:input aura:id="expenseform" label="Client"
                             name="expenseclient"
                             value="{!v.newExpense.Client__c}"
                             placeholder="Clients Name"/>
            
            
            <lightning:input type="date" aura:id="expenseform" label="Expense Date" 
                             placeholder="dd/mm/yyyy"
                             pattern="[0-9]{2}-[0-9]{2}-[0-9]{4}"
                             name="expensedate"
                             value="{!v.newExpense.Date__c}"/>
            
            <lightning:input type="checkbox" aura:id="expenseform" label="Reimbursed?"  
                             name="expreimbursed"
                             checked="{!v.newExpense.Reimbursed__c}"/>
            
            <lightning:button label="Create Expense" 
                              class="slds-m-bottom--small"
                              variant="brand"
                              onclick="{!c.clickCreate}"/> <!--controller call-->
       </form>
   </fieldset>
</div>
   			 <!-- / CREATE NEW EXPENSE -->
        		</lightning:layoutItem>
    				</lightning:layout>
    		<!-- / NEW EXPENSE FORM -->
    
    
    <!-- Adding component: expensesList.cmp -->
   		<c:expensesList/>

  </aura:component>

 
Hey all!
My first post so go easy!

I have an object, Project, which contains details of all project members. One of my projects is actaully my list of Project Managers.
When creating a New project I need to search and assign a PM from my "Project Managers" project.  I can set up a field Lookup but that is only to the object and not a specific record. Is there an easy way of achiveing this?

I do hope that makes sense!?
Hi,
I'm kinda new to salesforce administration.

I have found the way to set up the "home" page in Salesforce by clicking on "edit page".
My problem is I can customize the page only with certains items (in my case : "asistant", Chatter feed" (...) Report Chart", "today's tasks" for instense).

I need to setup a home page for my salesteams with several Reports. I just can't find the way to duplicate the "repoart chart" item and select different Charts.

I must be missing something here...
Hoping someone can advice,

thanx,
Denis

I want to get all contact filed label and API names using rest call. But I didn't find any endpoint for this.

Please tell me how to get it?

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.

Can you pls help on this question.
Q) What can an administrator configure for users on the search result page? Choose 3 answers
a. Columns displayed for each object
b. Filter by which users can narrow down results
c. Number of records displayed for each object
d. Fields being searched on for each object
e. Objects included in the search a. Columns displayed for each object
  • August 24, 2015
  • Like
  • 0