salesforce campus tour - developer intro
DESCRIPTION
Salesforce Campus Tour - Developer IntroTRANSCRIPT
![Page 1: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/1.jpg)
Salesforce 2014 Campus Tour
James Ward @_JamesWard
![Page 2: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/2.jpg)
Safe Harbor
Safe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
![Page 3: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/3.jpg)
#CampusTour14
![Page 4: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/4.jpg)
World’s most admired software company
#1 most admired in software
#7 best company to work for
2011 • 2012 • 2013 • 2014
World’s most innovative company
4TH YEAR IN A ROW!
*Source: IDC, Worldwide CRM Applications 2014-2018 Forecast and 2013 Vendor Shares, Doc #248875, June 2014
World’s #1 CRM company*
Image FPO
Celebrating 15 Years of Customer Success
![Page 5: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/5.jpg)
1%
Time • Equity • Product
530,000+Hours Service
20,000Non-profit
organizations
$53M+
Grants
foundation
![Page 6: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/6.jpg)
The Third Wave of Computing
![Page 7: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/7.jpg)
SNA
Terminal
Mainframe LAN / WAN
Client
Server
LAN / WAN
Client
Server
customer transactions
connected things
LTE
Mobile
Cloud
“Third Wave” of Computing
BillionsThousands Millions Trillions
![Page 8: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/8.jpg)
![Page 9: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/9.jpg)
![Page 10: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/10.jpg)
But Most Companies Are Disconnected From Customers
Service Agents
Salespeople
Your Company
Your Customers
Your Partners
![Page 11: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/11.jpg)
Become a Customer Company
Analytics for the rest of us
Build mobile apps
faster
Sell, Service, Market & Engage
in a whole new way
Connect with your customers in a whole new way
![Page 12: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/12.jpg)
Salesforce1: A New Customer Platform for the Future
Salesforce1 Platform APIs
Salesforce1 App
Salesforce1 Platform Services
Force.com Heroku1 ExactTarget Fuel
![Page 13: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/13.jpg)
Build Amazing Apps and Connect Everything.
Build Innovative
Customer apps
Automate Processes
with Employee Apps
Connect
Everything
![Page 14: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/14.jpg)
Branded social intranet built mobile first
Key business metrics customized for each ‘teammate”
Chatter collaboration for every department
Business users update content in real-time
Virgin America Connects Every Employee with a Social Intranet
![Page 15: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/15.jpg)
Trunk Club Connects Customers & Employees with Mobile Apps
Customer facing mobile app built on Heroku
Employee mobile app built on Force.com for order fulfillment
Integrated sales, service & marketing built on the Salesforce Platform
![Page 16: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/16.jpg)
Salesforce Academic Program
![Page 17: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/17.jpg)
![Page 18: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/18.jpg)
Demand is Growing Across Multiple Roles
Force.com Developer
Technical Architect
Solutions Architect
Principal Consultant
Business Analyst
Source: Hire On-Demand http://www.hireon-demand.com
60% 159% 90%of companies moving
to cloudDemand growth for all
Salesforce TalentDemand growth for
Salesforce Developers
![Page 19: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/19.jpg)
![Page 20: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/20.jpg)
Salary Average
Job Silicon Valley National
Force.com Data Analyst $95k $65k
Salesforce.com Administrators $100k $80k
Global Salesforce Administrators $120k $95k
Force.com Developers $125k $98k
Certified Force.com Developers $135k $115k
Sr. Force.com Developers $150k $125k
Force.com Architects $170k $140k
Force.com Solution Architects $200k $165k
Salesforce CRM Business Analysts $140k $110k
Salesforce CRM Program Managers $185k $135k
Salesforce Implementation Consultants $220k $175k
Source: Nelson Technologies, November 2013http://www.nelsontechnology.com
Salesforce Skills Earn Top Paying Jobs
![Page 21: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/21.jpg)
Campus EventsInternships &
Recruiting CurriculumMentorship & Experience
Classroom speakers
Workshops
Hackathons
Business Competitions
University
Conferences
Student User Groups
Company visits/tours
Internship Program
Recruitment
Courseware
Curriculum
Student/Faculty
licenses
Training & certification
Capstone projects
Entrepreneurship
Research projects
Student Ambassadors
Academic Program Components
![Page 22: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/22.jpg)
1 2 3Join Live Telecast onNovember 12, 2014
Compete in Salesforce1Challenge to win an Xbox
Attend a Campus Event
Salesforce Campus TourOct 24-Nov 14th
www.salesforcecampustour.com
![Page 23: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/23.jpg)
Keep Learning With Trailheaddeveloper.salesforce.com/trailhead
![Page 24: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/24.jpg)
Salesforce CertificationsKey Skills Preparation
• Manage users, data, and security• Maintain and customize Sales Cloud and Service Cloud
applications• Build reports, dashboards, and workflow
Administration Essentials for New Admins (ADM 201)
FREE Self-paced Training:• certifiedondemand.com
• Leverage advanced administration • Optimize and extend Sales Cloud and Service Cloud
applications• Design advanced reports, dashboards, and business
process automation
Administration Essentials for Experienced Admins (ADM-211)
FREE Self-paced Training:• Force.com Fundamentals Book
• Build custom applications using point-and-click • Design the data model, user interface, business logic,
and security for custom applications• Design reports, dashboards, and portals
Building Applications with Force.com and Visualforce (DEV401)
FREE Self-paced Training:• Udacity.com
• Develop custom applications using Apex & Visualforce• Manage the development lifecycle and environments• Write and execute comprehensive test plans
Apex and Visualforce Controllers (DEV501)
FREE Self-paced Training:• Introduction to Visualforce (YouTube)• www.sfdc99.com
![Page 25: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/25.jpg)
Campus Ambassador Program
Coming Soon!
![Page 26: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/26.jpg)
Salesforce FutureForce Program
salesforce.com/futureforce
![Page 27: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/27.jpg)
Lets Build an App!
https://ccoenraets.github.io/salesforce-developer-fasttrack/
![Page 28: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/28.jpg)
Two Approaches to Development
Visualforce PagesVisualforce Components
Apex ControllersApex Triggers
Metadata APIREST APIBulk API
Formula FieldsValidation Rules
Workflows and Approvals
Custom ObjectsCustom FieldsRelationships
Page LayoutsRecord Types
User Interface
Business Logic
Data Model
Declarative Approach Programmatic Approach
![Page 29: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/29.jpg)
Creating the Data Model
![Page 30: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/30.jpg)
Salesforce Objects
Similar to Tables (with more metadata)
Standard objects out-of-the-box
•Account, Contact, Opportunity, …
You can add custom fields to standard objects
•Rating__c, Twitter__c, …
You can create custom objects
• i.e. Speaker__c, Session__c, Hotel__c
Custom objects have standard fields
• Id, Owner, LastModifiedDate, LastModifiedBy, …
![Page 31: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/31.jpg)
Rich Data Types
Auto Number Formula Roll-Up Summary Lookup Master-Detail Checkbox Currency Date
Picklist (multi select) Text Text Area Text Area (Long) Text Area (Rich) Text (Encrypted) URL
Date/Time
Geolocation
Number
Percent
Phone
Picklist
![Page 32: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/32.jpg)
Modeling One-to-Many Relationships
An expense has one expense report
An expense report has many expenses
![Page 33: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/33.jpg)
Modeling Many-to-Many Relationships
A speaker can have many session assignments
A session can have many speaker assignments
![Page 34: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/34.jpg)
Id
All objects are given an Id field
Globally unique Id is assigned at record creation
"Primary key" used to access records
![Page 35: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/35.jpg)
Record Name
Human readable / logical identifier
Text or Auto Number ("Intro to Apex" or SP-00002)
Uniqueness not enforced
![Page 36: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/36.jpg)
When you create an Object, you get…
A CRUD user interface
Instant Mobile App access (Salesforce1)
A REST API
Rich Metadata
Indexed search
![Page 37: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/37.jpg)
Lab: Creating the Data Model
![Page 38: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/38.jpg)
Creating the Application
![Page 39: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/39.jpg)
What's an Application?
Group of tabs that provide easy access to related features Salesforce comes with standards apps
•Sales, Call Center, Marketing, …
You can create your own apps Tabs can be:
•Object pages, Visualforce pages, Canvas app
![Page 40: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/40.jpg)
Page Layouts
Let you customize all aspects of the layout, related lists, …
![Page 41: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/41.jpg)
Lab: Creating the Application
![Page 42: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/42.jpg)
Writing Apex Classes
![Page 43: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/43.jpg)
What is Apex?
Salesforce platform language
Cloud based compiling, debugging and unit testing
Object-oriented
Strongly typed
Classes and Interfaces
Similar to Java
![Page 44: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/44.jpg)
Apex and Java
Same Primitive data types
Flow control (if, for, while, …)
Exception handling
Collections: Lists, Sets, …
Different Case insensitive
Single quote strings: 'Joe'
Id data type
Built-in support for data access
![Page 45: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/45.jpg)
Apex Class
public class MortgageCalculator {
public Double amount { get; set; }
public Double rate { get; set; }
public Integer years { get; set; }
public Double calculateMonthlyPayment() {
Integer months = years * 12;
Double monthlyRate = rate / (12 * 100);
return amount * (monthlyRate/
(1 - Math.pow(1 + monthlyRate, -months)));
}
}
![Page 46: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/46.jpg)
Development Tools
Developer Console
Force.com IDE (Eclipse Plugin)
Mavens Mate (Sublime Plugin)
Force CLI
![Page 47: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/47.jpg)
Developer Console
Browser Based IDE
Create Classes, Triggers, Pages
Execute Apex Anonymously
Execute SOQL Queries
Run Unit Tests
Review Debug Logs
![Page 48: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/48.jpg)
Accessing Data with SOQL and DML
![Page 49: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/49.jpg)
SOQL
Salesforce Object Query language
Similar to SQL
Streamlined syntax to traverse object relationships
Built into Apex
![Page 50: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/50.jpg)
SELECT Id, Name, Phone FROM Contact
![Page 51: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/51.jpg)
SELECT Id, Name, Phone FROM Contact WHERE Phone <> null
![Page 52: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/52.jpg)
SELECT Id, Name, Phone FROM Contact WHERE Phone <> null AND Name LIKE '%rose%'
![Page 53: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/53.jpg)
SELECT Id, Name, Phone FROM Contact WHERE Phone <> null AND Name LIKE '%rose%' ORDER BY Name
![Page 54: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/54.jpg)
SELECT Id, Name, Phone, Account.Name FROM Contact WHERE Phone <> null AND Name LIKE '%rose%' ORDER BY Name
![Page 55: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/55.jpg)
SELECT Id, Name, Phone, Account.Name FROM Contact WHERE Phone <> null AND Name LIKE '%rose%' ORDER BY Name LIMIT 50
![Page 56: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/56.jpg)
Executing SOQL in the Developer Console
![Page 57: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/57.jpg)
Inlining SOQL in Apex
Integer i = [select count() from Session__c];
![Page 58: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/58.jpg)
Inlining SOQL in Apex
String level = 'Advanced';
List<Session__c> sessions =
[SELECT Name, Level__c FROM Session__c
WHERE Level__c = :level];
![Page 59: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/59.jpg)
Inlining SOQL in Apex
List<String> levels = new List<String>();
levels.add('Intermediate');
levels.add('Advanced');
List<Session__c> sessions =
[SELECT Name, Level__c FROM Session__c
WHERE Level__c IN :levels];
![Page 60: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/60.jpg)
Inlining SOQL in Apex
for (Speaker__c s : [select email__c from Speaker__c])
{
System.debug(s.email__c);
}
![Page 61: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/61.jpg)
insert
Session__c session = new Session__c();
session.name = 'Apex 101';
session.level__c = 'Beginner';
insert session;
![Page 62: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/62.jpg)
insert
Session__c session = new Session__c(
name = 'Apex 201',
level__c = 'Intermediate'
);
insert session;
![Page 63: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/63.jpg)
update
String oldName = 'Apex 101';
String newName = 'Apex for Beginners';
Session__c session = [SELECT Id, Name FROM Session__c
WHERE Name=:oldName];
session.name = newName;
update session;
![Page 64: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/64.jpg)
delete
String name = 'Testing 501';
Session__c session =
SELECT Name FROM Session__c
WHERE Name=:name];
delete session;
![Page 65: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/65.jpg)
Writing Triggers
![Page 66: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/66.jpg)
Trigger
Apex code executed on database events
Before or after:
• Insert
•Update
•Delete
•Undelete
![Page 67: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/67.jpg)
Before or After?
Before
•Update or validate values before they are saved to the database
•Example: Prevent double-booking of a speaker
After
•Need access to values set by the database (Id, lastUpdated, …)
•Example: Send speaker confirmation email
![Page 68: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/68.jpg)
Bulk Mode
Trigger API designed to support bulk operations
•Data Import, Bulk API, etc.
Triggers work on bulk of records, not single records
Context variables provide access to data:
•Trigger.old and Trigger.new (List)
•Trigger.oldMap and Trigger.newMap (Map)
![Page 69: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/69.jpg)
Example
Trigger on Account (after insert) {
for (Account account : Trigger.new) {
Case case = new Case();
case.Subject = 'Mail Welcome Kit';
case.Account.Id = account.Id;
insert case;
}
}
![Page 70: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/70.jpg)
Writing Visualforce Pages
![Page 71: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/71.jpg)
Model-View-Controller
ModelData + Rules
ControllerView-Modelinteractions
ViewUI code
Separation of concerns– No data access code in view
– No view code in controller
Benefits– Minimize impact of changes
– More reusable components
![Page 72: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/72.jpg)
Model-View-Controller in Salesforce
View• Metadata• Standard Pages• Visualforce Pages• External apps
Controller• Standard Controllers• Controller Extensions• Custom Controllers
(all Apex)
Model• Metadata• Objects• Triggers (Apex)• Classes (Apex)
![Page 73: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/73.jpg)
What's a Visualforce Page?
The View in MVC architecture
HTML page with tags executed at the server-side to generate dynamic content
Similar to JSP and ASP
Can leverage JavaScript and CSS libraries
![Page 74: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/74.jpg)
Expression Language
Anything inside of {! } is evaluated as an expression
Same expression language as Formulas
Same global variables are available. For example:
• {!$User.FirstName} {!$User.LastName}
![Page 75: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/75.jpg)
Example 1
<apex:page>
<h1>Hello, {!$User.FirstName}</h1>
</apex:page>
![Page 76: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/76.jpg)
Example 2
<apex:page standardController="Contact">
<apex:form>
<apex:inputField value="{!contact.firstname}"/>
<apex:inputField value="{!contact.lastname}"/>
<apex:commandButton action="{!save}" value="Save"/>
</apex:form>
</apex:page>
Function in standard controller
Standard controller
object
![Page 77: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/77.jpg)
Standard Controller
A standard controller is available for all objects
•You don't have to write it!
Provides standard CRUD operations
•Create, Update, Delete, Field Access, etc.
Can be extended with more capabilities (next module)
Uses id in URL to access object
![Page 78: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/78.jpg)
Component Library
Presentation tags
– <apex:pageBlock title="My Account Contacts"> Fine grained data tags
•<apex:outputField value="{!contact.firstname}">
•<apex:inputField value="{!contact.firstname}">
Coarse grained data tags
•<apex:detail>
•<apex:pageBlockTable>
Action tags
•<apex:commandButton action="{!save}" >
![Page 79: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/79.jpg)
Email Templates
Embedded in Page Layouts
Generate PDFs
Custom Tabs
Mobile Interfaces
Page Overrides
Where can I use Visualforce?
![Page 80: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/80.jpg)
Writing Controller Extensions
![Page 81: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/81.jpg)
Custom Controllers
Custom class written in Apex
Can override standard behavior
Can add new capabilities
![Page 82: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/82.jpg)
Defining a Controller Extension
<apex:page standardController="Speaker__c" extensions="SpeakerCtrlExt">
Provides basic CRUD
Overrides standard actions and/or provide additional capabilities
![Page 83: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/83.jpg)
Anatomy of a Controller Extension
public class SpeakerCtrlExt {
private final Speaker__c speaker;
private ApexPages.StandardController stdController;
public SpeakerCtrlExt (ApexPages.StandardController ctrl) {
this.stdController = ctrl;
this.speaker = (Speaker__c)ctrl.getRecord();
}
// method overrides
// custom methods
}
![Page 84: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/84.jpg)
All done. Take a survey!
http://bit.ly/devdayutaustin
![Page 85: Salesforce Campus Tour - Developer Intro](https://reader031.vdocuments.site/reader031/viewer/2022012918/559352371a28abc01b8b4587/html5/thumbnails/85.jpg)