Newer Version Available
Load the Contacts
-
Click , and then enter ContactController in the
New Class window. This creates a new Apex class,
ContactController.apxc. Enter this code and then save.
If you’re using a namespace in your organization, replace Level__c with myNamespace__Level__c.
getPrimary() returns all contacts whose Level__c field is set to Primary.
-
Click , and then enter contactList for the
Name field in the New Lightning Bundle popup window.
This creates a new component, contactList.cmp. Enter this
code and then save.
-
In the contactList sidebar, click STYLE to create a new resource
named contactList.css. Replace the placeholder code with
the following code and then save.
-
Click , and then enter contacts for the
Name field in the New Lightning Bundle popup window.
This creates a new component, contacts.cmp. Enter this code
and then save. If you’re using a namespace in your organization, replace ContactController with myNamespace.ContactController.
-
In the contacts sidebar, click CONTROLLER to create a new
resource named contactsController.js. Replace the
placeholder code with the following code and then save.
-
In the contacts sidebar, click HELPER to create a new resource
named contactsHelper.js. Replace the placeholder code with
the following code and then save.
- Create a new Lightning Component tab by following the steps on Add Lightning Components to Salesforce1. Make sure you include the component in the Salesforce1 navigation menu.
Finally, you can go to the Salesforce1 mobile browser app to check your output. When your component is loaded, you should see a toast message that indicates your contacts are loaded successfully.
Next, we’ll wire up the other events so that your input select displays either all contacts or only primary contacts that are colored green. We’ll also wire up events for opening the create record and edit record pages, and events for navigating to a record and a URL.