More Salesforce
MBF2 – Salesforce Webinar
Peter Chittum
Developer Evangelist
Salesforce
@pchittum
github.com/pchittum
Raouf Aimeur
Principle Solution Engineer
Salesforce
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 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, 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, risks associated with 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 quarter
ended January 31, 2015. This document and others 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 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.
Reminders
Sign in for a DE account :
1- developer.salesforce.com/signup
2- Fill out the form
Username must be unique
Create a Force.com Developer Edition account
How to create a free Heroku account ?
Sign in for an account :
1- www.heroku.com/
2- Click Sign Up in the upper right corner
3- Fill out the form
Learning Force.com and Heroku
Salesforce Trailhead Online Learning
developer.salesforce.com/trailhead
Many more resources at:
developer.salesforce.com
jr0cket’s Heroku Tutorial
agileforce.co.uk/heroku-workshop/
Many more resources at:
devcenter.heroku.com
Projects Basics
Set Up Your Org for Development
§  Session and Password Settings
§  Developer Login IP Whitelist
IDE Options
§  Eclipse IDE: Plugin by Salesforce
https://developer.salesforce.com/page/Force.com_IDE
§  Sublime Text 3: Plugin by MavensMate
http://mavensmate.com/
Local Project Artifacts
src
MyObject__c.object
...
MyApexClass.cls
MyApexClass.cls-meta.xml
...
classes (code)
objects (data model)
package.xml
Save from IDE
§  Automatic on local Save
§  Code is Compiled at Server
§  References Checked
Deploy to Different Environment
§  From IDE
§  Package
§  workbench.developerforce.com
Test/Prod
Dev
Retrieving Data
Data Model and the Force.com Platform
§  sObject:
–  Table-like data structure
•  Records
•  Fields
–  Extensible
–  Queryable/Updatable
–  Relationships
§  Automatic Features:
–  User Interface
–  Security
•  CRUD
•  Field-level
•  Record-level (ACL)
–  REST & SOAP APIs
–  Mobile
Standard Data Model
§  Standard Objects
–  Account
–  Contact
–  Lead
–  Opportunity
–  Case
–  …
§  Standard Fields
–  Id
–  Name
–  CreatedBy/Date
–  LastModifiedBy/Date
–  OwnerId
–  IsDeleted
–  …
Extensible Data Model
§  Custom Objects
–  Workshop__c
–  Room__c
–  …
§  Custom Fields
–  Status__c
–  Type__c
–  Start_Time__c
–  End_Time__c
–  …
Relationships: The Predefined Join
§  RDBMS
–  Join at runtime
with SQL or
view
§  Force.com
–  Predefined join
at design-time
–  Similar to
integrity
constraints
Master-DetailLookup
Relationship Types
NeverOptional
Cascade
Clear Field/Block/
Cascade*
Nullability
Delete Behavior
Child Inherits from Parent
Independent Parent/
Child
225
Record Sharing
Access
Max Allowed Fields
Demo Use Case:
–  Workshops and Rooms
SOQL
§  Salesforce Object Query Language
§  SQL-like syntax
§  Queries the Force.com Object Layer
§  Used in:
–  Apex
–  Developer Tools (Developer Console, Eclipse, Workbench, …)
–  API (REST, SOAP, Bulk, …)
From SQL to SOQL
§  At first may look familiar
§  Important differences
§  Learn the differences
§  Use good data design practices
From SQL to SOQL: The Familiar Bits
§  Table-like structure
§  Similar query syntax
§  Indexed
§  Transactional
§  Triggers
SELECT Id, Name,
Capacity__c
FROM Room__c
WHERE Capacity__c > 10
From SQL to SOQL: Immediate Differences
§  No select *
§  No views
§  SOQL is read-only
§  Limited indexes
§  Object-relational mapping is automatic
§  Schema changes protected
From SQL to SOQL: Differences To Learn
§  sObjects are not actually tables – multi-tenant
environment
§  Relationship metadata
–  Management of referential integrity
–  Predefines joins
–  Relationship query syntax
§  Query usage explicitly metered
–  API Batch Limits
–  Apex Governor Limits
The __c and __r Suffixes
Room__c
Workshop__c
Id
Id
Room__c
Room__r
Workshops__r Type:
List<Workshop__c>
Type: Id
Type: Room__c
1-M
Relationship Query: Child to Parent
SELECT Id, Name, Room__c,
Room__r.Id,
Room__r.Capacity__c
FROM Workshop__c
WHERE Status__c = ‘Open’
[
{
"Id": "a0145000000aBf4AAE",
"Name": "Yoga for Beginners",
"Room__c": "a00vn000000dU3dAAE",
"Room__r": {
"Id": "a00vn000000dU3dAAE",
"Capacity__c": 10
}
},
{
"Id": "a0145000000aBf4AAE",
"Name": "Yoga for Beginners",
"Room__c": "",
"Room__r": {}
}, ...
]
Relationship Query: Parent to Child
SELECT Id, Name,
(SELECT Id, Status__c
FROM Workshops__r)
FROM Room__c
WHERE Capacity__c > 10
[
{
"Id": "a00vn000000dU3dAAE",
"Name": "Salon 1 West",
"Workshops__r": [
{
"Id": "a0145000000aBf4AAE",
"Status__c": "Open"
},
{
"Id": "a0145000000aBd4AAE",
"Status__c": "Full"
}
]
}, ...
]
Querying for Intersection
Select Id, Name,
Room__r.Name,
Room__r.Capacity__c
FROM Workshop__c
WHERE
Room__r.Capacity__c > 8
[
{
"Id": "a0145000000aBf4AAE",
"Name": "Yoga for Beginners",
"Room__c": "a00vn000000dU3dAAE",
"Room__r": {
"Id": "a00vn000000dU3dAAE",
"Capacity__c": 10
}
},
{...},
...
]
Aggregate Queries
SELECT
COUNT(Id) rmCount,
MAX(Capacity__c) maxRmCap,
Configuration__c
FROM Room__c
GROUP BY Configuration__c
[
{
"rmCount": 4,
"maxRmCap": 6,
"Configuration__c": "Classroom"
},
{
"rmCount": 2,
"maxRmCap": 10,
"Configuration__c": "Theatre"
},
...
]
Demo Use Case:
–  Find a tally of empty spaces
being held for workshops that
are not actively enrolling
delegates
Heroku and
Salesforce
Heroku Resources
§  Create a simple Java App
agileforce.co.uk/heroku-workshop
§  node.js sample App
github.com/jeffdonthemic/node-nforce-demo
Mobile SDK
Single
Platform
Multiple
Platforms
NativeAdvanced UI interactions
Fastest performance
App Store distribution
HybridWeb developer skills
Access to native platform
App Store distribution
Full
Capability
Partial
Capability
HTML5Web developer skills
Instant updates
Unrestricted distribution
Mobile SDK Guide
§  Mobile SDK
developer.salesforce.com/mobile
Questions
Thank You
Appendix

Mbf2 salesforce webinar 2

  • 1.
    More Salesforce MBF2 –Salesforce Webinar
  • 2.
  • 3.
    Safe Harbor Safe harborstatement 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 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, 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, risks associated with 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 quarter ended January 31, 2015. This document and others 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 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.
  • 4.
  • 5.
    Sign in fora DE account : 1- developer.salesforce.com/signup 2- Fill out the form Username must be unique Create a Force.com Developer Edition account
  • 6.
    How to createa free Heroku account ? Sign in for an account : 1- www.heroku.com/ 2- Click Sign Up in the upper right corner 3- Fill out the form
  • 7.
    Learning Force.com andHeroku Salesforce Trailhead Online Learning developer.salesforce.com/trailhead Many more resources at: developer.salesforce.com jr0cket’s Heroku Tutorial agileforce.co.uk/heroku-workshop/ Many more resources at: devcenter.heroku.com
  • 8.
  • 9.
    Set Up YourOrg for Development §  Session and Password Settings §  Developer Login IP Whitelist
  • 10.
    IDE Options §  EclipseIDE: Plugin by Salesforce https://developer.salesforce.com/page/Force.com_IDE §  Sublime Text 3: Plugin by MavensMate http://mavensmate.com/
  • 11.
  • 12.
    Save from IDE § Automatic on local Save §  Code is Compiled at Server §  References Checked
  • 13.
    Deploy to DifferentEnvironment §  From IDE §  Package §  workbench.developerforce.com Test/Prod Dev
  • 14.
  • 15.
    Data Model andthe Force.com Platform §  sObject: –  Table-like data structure •  Records •  Fields –  Extensible –  Queryable/Updatable –  Relationships §  Automatic Features: –  User Interface –  Security •  CRUD •  Field-level •  Record-level (ACL) –  REST & SOAP APIs –  Mobile
  • 16.
    Standard Data Model § Standard Objects –  Account –  Contact –  Lead –  Opportunity –  Case –  … §  Standard Fields –  Id –  Name –  CreatedBy/Date –  LastModifiedBy/Date –  OwnerId –  IsDeleted –  …
  • 17.
    Extensible Data Model § Custom Objects –  Workshop__c –  Room__c –  … §  Custom Fields –  Status__c –  Type__c –  Start_Time__c –  End_Time__c –  …
  • 18.
    Relationships: The PredefinedJoin §  RDBMS –  Join at runtime with SQL or view §  Force.com –  Predefined join at design-time –  Similar to integrity constraints
  • 19.
    Master-DetailLookup Relationship Types NeverOptional Cascade Clear Field/Block/ Cascade* Nullability DeleteBehavior Child Inherits from Parent Independent Parent/ Child 225 Record Sharing Access Max Allowed Fields
  • 20.
    Demo Use Case: – Workshops and Rooms
  • 21.
    SOQL §  Salesforce ObjectQuery Language §  SQL-like syntax §  Queries the Force.com Object Layer §  Used in: –  Apex –  Developer Tools (Developer Console, Eclipse, Workbench, …) –  API (REST, SOAP, Bulk, …)
  • 22.
    From SQL toSOQL §  At first may look familiar §  Important differences §  Learn the differences §  Use good data design practices
  • 23.
    From SQL toSOQL: The Familiar Bits §  Table-like structure §  Similar query syntax §  Indexed §  Transactional §  Triggers SELECT Id, Name, Capacity__c FROM Room__c WHERE Capacity__c > 10
  • 24.
    From SQL toSOQL: Immediate Differences §  No select * §  No views §  SOQL is read-only §  Limited indexes §  Object-relational mapping is automatic §  Schema changes protected
  • 25.
    From SQL toSOQL: Differences To Learn §  sObjects are not actually tables – multi-tenant environment §  Relationship metadata –  Management of referential integrity –  Predefines joins –  Relationship query syntax §  Query usage explicitly metered –  API Batch Limits –  Apex Governor Limits
  • 26.
    The __c and__r Suffixes Room__c Workshop__c Id Id Room__c Room__r Workshops__r Type: List<Workshop__c> Type: Id Type: Room__c 1-M
  • 27.
    Relationship Query: Childto Parent SELECT Id, Name, Room__c, Room__r.Id, Room__r.Capacity__c FROM Workshop__c WHERE Status__c = ‘Open’ [ { "Id": "a0145000000aBf4AAE", "Name": "Yoga for Beginners", "Room__c": "a00vn000000dU3dAAE", "Room__r": { "Id": "a00vn000000dU3dAAE", "Capacity__c": 10 } }, { "Id": "a0145000000aBf4AAE", "Name": "Yoga for Beginners", "Room__c": "", "Room__r": {} }, ... ]
  • 28.
    Relationship Query: Parentto Child SELECT Id, Name, (SELECT Id, Status__c FROM Workshops__r) FROM Room__c WHERE Capacity__c > 10 [ { "Id": "a00vn000000dU3dAAE", "Name": "Salon 1 West", "Workshops__r": [ { "Id": "a0145000000aBf4AAE", "Status__c": "Open" }, { "Id": "a0145000000aBd4AAE", "Status__c": "Full" } ] }, ... ]
  • 29.
    Querying for Intersection SelectId, Name, Room__r.Name, Room__r.Capacity__c FROM Workshop__c WHERE Room__r.Capacity__c > 8 [ { "Id": "a0145000000aBf4AAE", "Name": "Yoga for Beginners", "Room__c": "a00vn000000dU3dAAE", "Room__r": { "Id": "a00vn000000dU3dAAE", "Capacity__c": 10 } }, {...}, ... ]
  • 30.
    Aggregate Queries SELECT COUNT(Id) rmCount, MAX(Capacity__c)maxRmCap, Configuration__c FROM Room__c GROUP BY Configuration__c [ { "rmCount": 4, "maxRmCap": 6, "Configuration__c": "Classroom" }, { "rmCount": 2, "maxRmCap": 10, "Configuration__c": "Theatre" }, ... ]
  • 31.
    Demo Use Case: – Find a tally of empty spaces being held for workshops that are not actively enrolling delegates
  • 32.
  • 33.
    Heroku Resources §  Createa simple Java App agileforce.co.uk/heroku-workshop §  node.js sample App github.com/jeffdonthemic/node-nforce-demo
  • 34.
  • 35.
    Single Platform Multiple Platforms NativeAdvanced UI interactions Fastestperformance App Store distribution HybridWeb developer skills Access to native platform App Store distribution Full Capability Partial Capability HTML5Web developer skills Instant updates Unrestricted distribution
  • 36.
    Mobile SDK Guide § Mobile SDK developer.salesforce.com/mobile
  • 37.
  • 38.
  • 39.