• 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
I've been following along in the "Einstein Bots Developer Cookbook" and so far things have gone really well.  However, I hit the section called "Create Dynamic Menus" and can't figure out what's going on. 

I'm using the same code that supplied in the Cookbook.  Here's the code I'm using.
 
public with sharing class CookbookBot_GetOpenAppointments {
    
    @InvocableMethod(label='Get Open Appointments')
    public static List<List<Bot_Appointment__c>> getOpenAppointments(List<String> sEmails) {
        
        String sEmail = sEmails[0]; 
        system.debug('sEmail = ' + sEmail);
        
        // Get the list of new and scheduled appointments
        List<Bot_Appointment__c> appointments = [SELECT Id, Name, JobType__c, AppointmentDate__c, AppointmentSlot__c
                                                FROM Bot_Appointment__c
                                                WHERE Contact__r.Email = :sEmail
                                                AND Status__c IN ('New', 'Scheduled')];
        
        system.debug('Appointments: ' + appointments); 
        
        // Create a list for the appointments
        // NOTE: This is a list of lists in order to handle bulk calls...
        List<List<Bot_Appointment__c>> appointmentList = new List<List<Bot_Appointment__c>>();
        
        // Add all the new and scheduled appointments to the list
        appointmentList.add(appointments);
        
        return appointmentList;
    }
}
I verified that my email address is getting captured correctly.

I also have used Query Editor to verify the SOQL query works correctly from the Developer Console.  The following is from Debug.

SELECT Id, Name, JobType__c, AppointmentDate__c, AppointmentSlot__c FROM Bot_Appointment__c WHERE (Contact__r.Email = :tmpVar1 AND Status__c IN ('New', 'Scheduled'))

However, the system is not finding any records despite the fact when I run the query above in the Developer Console (and replace ":tmpVar1" with my email address) that records are returned. 

What am I missing?  Here's the node in the Bot where Apex is getting called.

User-added image
I added some debug, but again, it seems like the Apex class is not returning any values from the query...which is really odd. 

USER_DEBUG|[15]|DEBUG|Appointments: ()

Thoughts?  Is something missing from the Class?

Thank you for your consideration and help!


 
We have multiple Record Types on the Case object.  We also have folks who work across Record Types (they're not just tied to a single Record Type).

I tried writing a Lightning Web Component to bubble up the Record Type name so Staff know if they're working with a record that is RecordType1, RecordType2, or RecordType3.

While I can pull other pieces of data from the Case object (such as Case Number, and Contact), I can't seem to expose the name of the Record type.  Any ideas?  I'm pretty new to development so I've been trying to cobble something together and would appreciate any insight / thoughts and help!

Here's my code snippets.

recordTypeForCase.js
import { LightningElement, api } from 'lwc';

export default class HelixITSMType extends LightningElement {
    @api recordId; // Case Id
}

RecordTypeForCase.html​​​​​​​
<template>
    <lightning-card class="slds-text-title_bold" title="Record Type" icon-name="standard-people">
        <div class="slds-m-around_medium">
        <!-- Show Helix ITSM Record Type when Case is loaded -->
            <lightning-record-view-form record-id={recordId} object-api-name="Case">
                <div class="slds-grig">
                    <div class="slds-col slds-size_1-of-2">
                        <lightning-output-field field-name="CaseNumber"></lightning-output-field>
                        <lightning-output-field field-name="RecordTypeId"></lightning-output-field>
                        <lightning-output-field field-name="ContactId"></lightning-output-field>
                    </div>
                </div>
            </lightning-record-view-form>
        </div>
     </lightning-card>   
</template>

Thank you in advance for your help and advice.  

Virginia
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.
Is it me or is this trail and modules all over the map?  I remember going through this months ago, and it was very good about building out the Camping List...but now it seems to be a mash up of Hello World, the Expense App and the Camping List scenarios and it's all very confusing.  Its as if someone tried to take those three different examples and try to cram them all in one place.
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

 
I know I can pass this URL and automatically log in to Salesforce without having to interface with the login page:

https://login.salesforce.com/?un=username@11myorg.com&pw=password

Is there a way to build out the above URL so that once the user is logged in, they're immediately taken to a specific tab?  If so, what would that URL look like (assuming it's possible).

Thanks!

 
Please bear with me as I'll admit coding is something I'm new at and trying to learn! 

I create a very simple Flow, called ReturnHelloWorld.  It's only job is to display a message (using the Screen element) that says "Hello World!".

I created the following Apex Class:
public class ReturnHelloWorld {

    Flow.Interview.ReturnHelloWorld helloWorldFlow {get; set;}

}
I then created the following Apex Trigger to call the Class:
 
trigger CallMyFlow on Case (after insert) {
	
    for (Case c  : trigger.New) {
        
        ReturnHelloWorld hello = new ReturnHelloWorld();
    }

}
When I create a Case and save it, the Flow is not launched.  Based on all the reading and research I've done so far, it seems that really the only way for this to work is to call the Apex Class from a Visualforce page.  I wanted to confirm and make sure my code is correct.

Thanks for your help!


 
As I work through the Module called "Lightning Components", I'm wondering if anyone has come up with a debugging pattern? 

For example, on the Calculate Total exercise, it would have been great that as the JavaScript ran, I could somehow see into how each variable was being set to make sure I was getting the values I think I'm getting.

Any ideas?  Thoughts?

Thank you for your time!
Module: Lightening Components
Section: Handling Events with Client-Side Controllers
Component Event Example

I tried following the example in this exercise for Component Event Example, but I think there's something missing in the "receiverController.js".  The code sample is identical to that of "Application Event Example".  Now I get this with the first two buttons doing nothing (Message: None never changes) but the second set of buttons working correctly.  What am I or the sample code missing?

receiverController.js
({
    answer : function(component, event, helper) {
        var text = event.getParam("text");
        component.set("v.myText", text);
    }
})

What I get:
myApp.app Example

Thank you for your guidance and time! 
 
I have two separate orgs.  They're sort of the same, but not really.  

Is there a tool or tools out there to not only compare Metadta, but also to compare Data?  

Any thoughts or suggestions?  

As always, thank you for your feedback!

V
So in the past I have used Eclipse IDE and simply downloaded the latest Force.com IDE API via the URL:

http://media.developerforce.com/force-ide/eclipse42

However, I noticed that the API has not been updated since Summer 14.  I can only seem to get API 31.  

What's the new "platform" for using to develop code in Salesforce.  I hate to admit it, but I actually loved Eclipse and the IDE plug-in.

Any advise or suggestions are appreciated!

Virginia
I've found tons of information on how to render a Visualforce page as PDF; but that's not what I want to do.

I have a PDF that I've added to a zip file and uploaded as a static resource.

I now want to create a Visualforce page, with a link that when clicked a new browser tab is launched and the PDF from the static resource is displayed to the user.

Any assistance is always appreciated!

Virginia
So as I always like to start each conversation, I consider myself a freshman to sophmore developer.  I'm digging in and trying to learn so I very much appreciate all the help!

In the Salesforce1 Workbook, they talk about the Enchanced Warehouse Schema app that you can install onto an org and then build out a visualforce page to utilize the googleMapsAPI static resource (which is a javascript).  On my first "sample" Org I installed the the package and I can successfully run the pre-packaged Completed_FindNearbyWarehousesPage.

So far so good.

Now..since I'm a glutton for punishment, and I really am trying to learn the "guts"...I wanted to build this out manually in a second test Org. 

I created my Warehouse object and the necessary fields. 

I then uploaded the googleMpasAPI javascript as a static resource. 

Next I built out a visualforce page simply called FindNearbyWarehoursePage. 

However, on the org where I tried to build out manually vs. installing the package, my VF page doesn't return anything.  However on the org where I installed the package, the page resolves to my current location.

Now...for the details......

First...my class, FindNearby.
global with sharing class FindNearby {

    public FindNearby(ApexPages.StandardSetController controller) { }

    @RemoteAction
    // Find warehouses nearest a geolocation
    global static List<Warehouse__c> getNearby(String lat, String lon){
    
        // If geolocation isn't set, use San Francisco, CA 
        if(lat == null || lon == null || lat.equals('') || lon.equals('')){
            lat = '37.77493';
            lon = '-122.419416';
        }
        
        // SOQL query to get the nearest warehouses
        String queryString = 
           'SELECT Id, Name, Location__Longitude__s, Location__Latitude__s, ' + 
               'Street_Address__c, Phone__c, City__c ' + 
           'FROM Warehouse__c ' +
           'WHERE DISTANCE(Location__c, GEOLOCATION('+lat+','+lon+'), \'mi\') < 20 ' +
           'ORDER BY DISTANCE(Locatoin__c, GEOLOCATION('+lat+','+lon+'), \'mi\') ' +           
           'LIMIT 10';
           
           // Run and return the query results
           return(database.Query(queryString));                
    }
}
Next up...my googleMapsAPI javascript that I uploaded as a static resource.
window.google = window.google || {};
google.maps = google.maps || {};
(function() {
  
  function getScript(src) {
    document.write('<' + 'script src="' + src + '"' +
                   ' type="text/javascript"><' + '/script>');
  }
  
  var modules = google.maps.modules = {};
  google.maps.__gjsload__ = function(name, text) {
    modules[name] = text;
  };
  
  google.maps.Load = function(apiLoad) {
    delete google.maps.Load;
    apiLoad([0.009999999776482582,[[["https://mts0.googleapis.com/vt?lyrs=m@229000000\u0026src=api\u0026hl=en-US\u0026","https://mts1.googleapis.com/vt?lyrs=m@229000000\u0026src=api\u0026hl=en-US\u0026"],null,null,null,null,"m@229000000"],[["https://khms0.googleapis.com/kh?v=135\u0026hl=en-US\u0026","https://khms1.googleapis.com/kh?v=135\u0026hl=en-US\u0026"],null,null,null,1,"135"],[["https://mts0.googleapis.com/vt?lyrs=h@229000000\u0026src=api\u0026hl=en-US\u0026","https://mts1.googleapis.com/vt?lyrs=h@229000000\u0026src=api\u0026hl=en-US\u0026"],null,null,null,null,"h@229000000"],[["https://mts0.googleapis.com/vt?lyrs=t@131,r@229000000\u0026src=api\u0026hl=en-US\u0026","https://mts1.googleapis.com/vt?lyrs=t@131,r@229000000\u0026src=api\u0026hl=en-US\u0026"],null,null,null,null,"t@131,r@229000000"],null,null,[["https://cbks0.googleapis.com/cbk?","https://cbks1.googleapis.com/cbk?"]],[["https://khms0.googleapis.com/kh?v=81\u0026hl=en-US\u0026","https://khms1.googleapis.com/kh?v=81\u0026hl=en-US\u0026"],null,null,null,null,"81"],[["https://mts0.googleapis.com/mapslt?hl=en-US\u0026","https://mts1.googleapis.com/mapslt?hl=en-US\u0026"]],[["https://mts0.googleapis.com/mapslt/ft?hl=en-US\u0026","https://mts1.googleapis.com/mapslt/ft?hl=en-US\u0026"]],[["https://mts0.googleapis.com/vt?hl=en-US\u0026","https://mts1.googleapis.com/vt?hl=en-US\u0026"]],[["https://mts0.googleapis.com/mapslt/loom?hl=en-US\u0026","https://mts1.googleapis.com/mapslt/loom?hl=en-US\u0026"]],[["https://mts0.googleapis.com/mapslt?hl=en-US\u0026","https://mts1.googleapis.com/mapslt?hl=en-US\u0026"]],[["https://mts0.googleapis.com/mapslt/ft?hl=en-US\u0026","https://mts1.googleapis.com/mapslt/ft?hl=en-US\u0026"]]],["en-US","US",null,0,null,null,"https://maps.gstatic.com/mapfiles/","https://csi.gstatic.com","https://maps.googleapis.com","https://maps.googleapis.com"],["https://maps.gstatic.com/intl/en_us/mapfiles/api-3/14/1","3.14.1"],[3209180036],1,null,null,null,null,0,"",null,null,1,"https://khms.googleapis.com/mz?v=135\u0026",null,"https://earthbuilder.googleapis.com","https://earthbuilder.googleapis.com",null,"https://mts.googleapis.com/vt/icon",[["https://mts0.googleapis.com/vt","https://mts1.googleapis.com/vt"],["https://mts0.googleapis.com/vt","https://mts1.googleapis.com/vt"],[null,[[0,"m",229000000]],[null,"en-US","US",null,18,null,null,null,null,null,null,[[47],[37,[["smartmaps"]]]]],0],[null,[[0,"m",229000000]],[null,"en-US","US",null,18,null,null,null,null,null,null,[[47],[37,[["smartmaps"]]]]],3],[null,[[0,"h",229000000]],[null,"en-US","US",null,18,null,null,null,null,null,null,[[50],[37,[["smartmaps"]]]]],0],[null,[[0,"h",229000000]],[null,"en-US","US",null,18,null,null,null,null,null,null,[[50],[37,[["smartmaps"]]]]],3],[null,[[4,"t",131],[0,"r",131000000]],[null,"en-US","US",null,18,null,null,null,null,null,null,[[5],[37,[["smartmaps"]]]]],0],[null,[[4,"t",131],[0,"r",131000000]],[null,"en-US","US",null,18,null,null,null,null,null,null,[[5],[37,[["smartmaps"]]]]],3],[null,null,[null,"en-US","US",null,18],0],[null,null,[null,"en-US","US",null,18],3],[null,null,[null,"en-US","US",null,18],6],[null,null,[null,"en-US","US",null,18],0]]], loadScriptTime);
  };
  var loadScriptTime = (new Date).getTime();
  getScript("https://maps.gstatic.com/intl/en_us/mapfiles/api-3/14/1/main.js");
})();
Finally...my Visualforce page, FindNearbyWarehousesPage.  Note that when I load this page from my environment I'm getting a blank white page.  No error, the browser isn't asking if I want to use my current location or anything.
<apex:page sidebar="false" showheader="false" standardController="Warehouse__c" recordSetVar="warehouses" extensions="FindNearby">
    
    <!-- Include in Google's Maps API via JavaScript static resource -->
    <apex:includeScript value="{!$Resource.googleMapsAPI}" /> 
    
    <!-- Set this API key to fix JavaScript errors in production -->
    <!--http://salesforcesolutions.blogspot.com/2013/01/integration-of-salesforcecom-and-google.html-->
    <!--<script type="text/javascript" 
        src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&sensor=false"> 
        </script>-->
        
    <!-- Setup the map to take up the whole window --> 
    <style>
        html, body { height: 100%; }
        .page-map, .ui-content, #map-canvas { width: 100%; height:100%; padding: 0; }
        #map-canvas { height: min-height: 100%; }
    </style>
    
    <script>
        function initialize() {
            var lat, lon;
              
             // If we can, get the position of the user via device geolocation
             if (navigator.geolocation) {
                 navigator.geolocation.getCurrentPosition(function(position){
                     lat = position.coords.latitude;
                     lon = position.coords.longitude;                    
                     
                     // Use Visualforce JavaScript Remoting to query for nearby warehouses      
                     Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.FindNearby.getNearby}', lat, lon,
                         function(result, event){
                             if (event.status) {
                                 console.log(result);
                                 createMap(lat, lon, result);           
                             } else if (event.type === 'exception') {
                                 //exception case code          
                             } else {
                                            
                             }
                          }, 
                          {escape: true}
                      );
                  });
              } else {
                  // Set default values for map if the device doesn't have geolocation capabilities
                    /** San Francisco **/
                    lat = 37.77493;
                    lon = -122.419416;
                    
                    var result = [];
                    createMap(lat, lon, result);
              }
          
         }
    
         function createMap(lat, lon, warehouses){
            // Get the map div, and center the map at the proper geolocation
            var currentPosition = new google.maps.LatLng(lat,lon);
            var mapDiv = document.getElementById('map-canvas');
            var map = new google.maps.Map(mapDiv, {
                center: currentPosition, 
                zoom: 13,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            });
            
            // Set a marker for the current location
            var positionMarker = new google.maps.Marker({
                map: map,
                position: currentPosition,
                icon: 'http://maps.google.com/mapfiles/ms/micons/green.png'
            });
            
                        
            // Keep track of the map boundary that holds all markers
            var mapBoundary = new google.maps.LatLngBounds();
            mapBoundary.extend(currentPosition);
            
            // Set markers on the map from the @RemoteAction results
            var warehouse;
            for(var i=0; i<warehouses.length;i++){
                warehouse = warehouses[i];
                console.log(warehouses[i]);
                setupMarker();
            }
            
            // Resize map to neatly fit all of the markers
            map.fitBounds(mapBoundary);

           function setupMarker(){ 
                var warehouseNavUrl;
                
                // Determine if we are in Salesforce1 and set navigation link appropriately
                try{
                    if(sforce.one){
                        warehouseNavUrl = 
                            'javascript:sforce.one.navigateToSObject(\'' + warehouse.Id + '\')';
                    }
                } catch(err) {
                    console.log(err);
                    warehouseNavUrl = '\\' + warehouse.Id;
                }
                
                var warehouseDetails = 
                    '<a href="' + warehouseNavUrl + '">' + 
                    warehouse.Name + '</a><br/>' + 
                    warehouse.Street_Address__c + '<br/>' + 
                    warehouse.City__c + '<br/>' + 
                    warehouse.Phone__c;
               
               // Create the callout that will pop up on the marker     
               var infowindow = new google.maps.InfoWindow({ 
                   content: warehouseDetails
               });
               
               // Place the marker on the map   
               var marker = new google.maps.Marker({
                   map: map,
                   position: new google.maps.LatLng( 
                                   warehouse.Location__Latitude__s, 
                                   warehouse.Location__Longitude__s)
               });
               mapBoundary.extend(marker.getPosition());
               
               // Add the action to open up the panel when it's marker is clicked      
               google.maps.event.addListener(marker, 'click', function(){
                   infowindow.open(map, marker);
               });
           }
        }
        
        // Fire the initialize function when the window loads
        google.maps.event.addDomListener(window, 'load', initialize);
        
    </script>
    
    <!--  All content is rendered by the Google Maps code -->
    <!--  This minimal HTML justs provide a target for GMaps to write to -->
    <body style="font-family: Arial; border: 0 none;">
        <div id="map-canvas"></div>
    </body>
</apex:page>
I even went so far as copying the code from the "working" environment to my "manual test" environment...and still I just get the blank page.  I must be missing something....but I'm at a loss as to what.  Could it be the static resource?  I uploaded the pure .js file vs. zipping it up.....

As always...I appreciate the time and insight!

Virginia





I have a formula that pretty much works correct:

IF(ISNULL(dueDateTime__c), "YES",
( IF( ISNULL(closeDateTime__c), ( IF(dueDateTime__c >=  NOW(), "YES", "NO")),
( IF(dueDateTime__c >= closeDateTime__c, "YES", "NO"))
))
)
So far so good...however I have yet another condition I want to check.  

Effecively if the Completed Date is not null and Close Date is greater than or equal to Due Date, then the field is "YES".

So I came up with this:

IF(ISNULL(dueDateTime__c), "YES", 
	( IF( ISNULL(closeDateTime__c), ( IF(dueDateTime__c >= 	NOW(), "YES", "NO")), 
	( IF(dueDateTime__c >= closeDateTime__c, "YES", "NO")),
	( IF (AND( NOT(ISNULL(CompletedDate__c), (IF(closeDateTime__c >= dueDateTime__c, "YES", "NO")))))))))

However, I get the following error:

Error: Syntax error. Missing ')'

I'll spare you the details of all the gyrations I've gone through the the ')'.  Suffice it to say the cursor goes to the comma ( , ) after the (CompletedDate__c) field.

As always your help is always appreciated!  Thank you!

This relates to a custom object, but could easily be any standard object in Salesforce.

 

Basically I'm wanting to run a report that shows all records owned by the person logged into Salesforce.

 

In this instance we have an object called Incidents.  

 

I have a report where I defined the filter as:

 

Incident: Owner Name equals ""
 
Before I even started on the VF page, I first created a custom link that I could add to my standard page layout and verify that the person who is logged into Salesforce would have their name passed to the report.  My custom link URL is this:
 
/00Oi0000004ZLjh?pv0={!User.Name}
 
Works great.  If I log in as myself and click on the link, I see all Incidents that I own.  If I log in as someone else, then he sees all the incidents that he owns.
 
So far...so good!
 
Now what I want is a Visualforce Page that would host a number of these Report "URLs" that a logged in user could select from.
 
<apex:page standardController="Incident__c">

<p>
   <a href = "/00Oi0000004ZLjh?pv0={!User.Name}" target="_blank">Incidents Assigned to Me</a>
</p>

</apex:page>

 When I try and save the page, I get:

 

Error: Unknown property 'BMCServiceDesk__Incident__cStandardController.User'

 

I also tried this:

 

<apex:page standardController="BMCServiceDesk__Incident__c">

<p>
   <a href = "/00Oi0000004ZLjh?pv0={$User.Name}" target="_blank">My Incidents</a>
</p>

</apex:page>

 

I'm able to save the page; howerver when I click on the URL link to the report, it looks like this and I'm not getting any data returned.

 

https://na15.salesforce.com/00Oi0000004ZLjh?pv0={$User.Name}

 

Is there another "session" variable equivilent to Owner Name that I could use in this instance?

 

Thank you!

Virginia

 

 

I have a trigger that essentially makes the Comment for an approval required.  That works fine.  I'm now trying to write my corresponding test class and running into a problem.

 

The error I get when I run the test, is:

 

Error Message: System.DmlException: Process failed. First exception on row 0; first error: INVALID_OPERATION, Illegal transition type: []

Stack Trace: Class.TestRequireApprovalComment.myUnitTest: line 70, column 1

 

I ran the test through Eclipse, and of course I come up with this...so it's definately failing by not submitting the approval and processing it correctly; I think.

 

13:13:22.932 (9932689000)|EXCEPTION_THROWN|[75]|System.AssertException: Assertion Failed: Instance StatusPending: Expected: Approved, Actual: Pending
13:13:22.932 (9932955000)|FATAL_ERROR|System.AssertException: Assertion Failed: Instance StatusPending: Expected: Approved, Actual: Pending

 

Any ideas, thoughts or suggestions?  I'm pretty new at Apex and coding...so close and yet so far!

 

Thank you!

vleandro

 

@isTest(SeeAllData=true)
private class TestRequireApprovalComment {

   static testMethod void myUnitTest() {
   	
	    // Insert a change request
		List<User> lstUser = [select Id from User where IsActive = True and IsStaffUser__c = True limit 1];
		
		Change_Request__c chreq = new Change_Request__c();
		chreq.FKStatus__c = [select id from Status__c where name like 'OPENED' limit 1].id;
		chreq.Change_Type__c = 'Standard';
		chreq.FKCategory__c = [select id from Category__c limit 1].id;
		chreq.Change_Description__c = 'test';
		
		if(lstUser.size()>1) {
			chreq.ownerid=lstUser[0].Id;
		}
		
		insert chreq;
    	
    	//Create an approval request for the change
    	Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
    	req1.setComments('Submitting request for approval.');
    	req1.setObjectId(chreq.Id);
    	req1.setNextApproverIds(new Id[] {UserInfo.getUserId()});
    	
    	//Submit the approval request for the change
    	Approval.ProcessResult result = Approval.process(req1);
    	
    	//Verify the result
    	System.assert(result.isSuccess());
    	
    	System.assertEquals('Pending', result.getInstanceStatus(), 'Instance Status'+result.getInstanceStatus());
    		
    	//Approve the submitted request.  
    	//First, get the ID of the newly created item
    	List<Id> newWorkItemIds = result.getNewWorkItemIds();
    	
    	//Instantiate the new ProcessWorkItemRequest object and populate it
    	Approval.ProcessWorkItemRequest req2 = new Approval.ProcessWorkItemRequest();
    	req2.setComments('Approving request.');
    	req2.setAction('Approve');
    	req2.setNextApproverIds(new Id[] {UserInfo.getUserId()});
    	
    	//Use the ID from the newly created item to specify the item to be worked
    	req2.setWorkItemId(newWorkItemIds.get(0));
    	
    	//Submit the request for approval
    	Approval.ProcessResult result2 = Approval.process(req2);
    	
    	//Verify the results
    	System.assert(result2.isSuccess(), 'Result Status:'+result2.isSuccess());
    	
    	System.assertEquals(
    		'Approved', result2.getInstanceStatus(), 
    		'Instance Status'+result2.getInstanceStatus());
    }	
}

 

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?

Hi,

I've developed a custom Open CTI implementation for Lightning Service Console. I've been using Lightning components which are wrapped in a Visualforce page (to be able to create a Call Center and use click2dial - which is not possible without Visualforce as I found out). This results in an iframe which contains the Visualforce page. Unfortunately workspaceAPI stopped working when being in the iframe.
I've used workspaceAPI in the following way:
<lightning:workspaceAPI aura:id="workspace" />
Controller looks like this:
var workspaceAPI = component.find("workspace");
workspaceAPI.openTab({
    recordId:'0012F0000089wQuQAI',
	focus: true
}).then(function(response) {
	console.log('in then');
	workspaceAPI.focusTab({
	    tabId: response
	});
}).catch(function(error) {
	 console.log('in catch');
});
I've double checked that record ID exists. This code does not throw an error, 'in then' and 'in catch' is never logged to JS console and tab is not opened. Basically any functionality of workspaceAPI does not work in iframe.

Thanks for any help.
Marek
 
The "Apex Web Services" trailhead unit/module says to get the session id form the Workbench -> Session Information menu option in the connection  folder.  But I don't know if I'm doing something wrong but I don't see any session id value listed there.

So I found another simple way to get the session id to pass into cURL command line as instructed by the trailhead.

Simply copy and paste the following line into the Execute Annoymous Window of the developer console and view the log file:

System.debug('Sessionid='+UserInfo.getSessionId());