SlideShare ist ein Scribd-Unternehmen logo
1 von 36
Downloaden Sie, um offline zu lesen
December 1, 2015
Lorem Ipsum Dolor
Forward-Looking Statement
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.
Go Social!
Salesforce Developers
Salesforce Developers
Salesforce Developers
The video will be posted to YouTube & the
webinar recap page (same URL as registration).This webinar is being recorded!
@salesforcedevs / #forcewebinar
▪ Don’t wait until the end to ask your question!
– Technical support will answer questions starting now.
▪ Respect Q&A etiquette
– Please don’t repeat questions. The support team is working
their way down the queue.
▪ Stick around for live Q&A at the end
– Speakers will tackle more questions at the end, time-
allowing.
▪ Head to Developer Forums
– More questions? Visit developer.salesforce.com/forums
Have Questions?
SOQL for the SQL Developer
Look for the blog post: http://bit.ly/soql4sql
Agenda
▪ Data Model & Relationships
– Comparing Force.com with Relational DBMS
– Relationship Types & the Predefined Join
▪ Relationships & SOQL
– SOQL vs SQL
– Relationship Queries
Assumptions
▪ A basic understanding of the Force.com Platform including:
– Creating Custom Objects and Fields
– Navigating the UI
▪ Knowledge of relational database concepts
– Tables
– Primary/Foreign Keys
– Joins
Agenda
▪ Data Model & Relationships
▪ Relationships & SOQL
Data Model and the Force.com Platform
▪ SObject:
– Table-like data structure
• Records
• Fields
– Extensible
– Queryable/Updatable
– Relationships
SObjects Drive Customization
Property__c
Broker__c
Desktop Mobile
Business
Process
Reporting
Security Model and Sharing
/SObjects/Property__c
APIs
Programmatic Customization
Broker__c brkr = new Broker__c();
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
– Property__c
– Broker__c
– Favorite__c
– …
▪ Custom Fields
– Status__c
– City__c
– Baths__c
– Beds__c
– Mobile_Phone__c
– …
Relationships: The Predefined Join
▪ RDBMS
– Design: Constraint
– Runtime: Query with Join
▪ Force.com
– Design: Constraint and Join
– Runtime: Relationship Query
Master-DetailLookup
Relationship Types
NeverOptional
Cascade
Clear
Field/Block/Cascade*
Nullability
Delete Behavior
Child Inherits from ParentIndependent Parent/Child
225
Record Sharing
Access
Max Allowed Fields
Demo
Dreamhouse App
Property and Broker Relationship
developer.salesforce.com/dreamhouse
Agenda
▪ Data Model & Relationships
▪ Relationships & SOQL
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, Streaming, etc.…)
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, Status__c
FROM Property__c
WHERE Beds__c > 2
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
Broker__c
Property__c
Id
Id
Broker__c
Broker__r
Properties__r
Type: List<Property__c>
Type: Id
Type: Broker__c
1-M
Relationship Query: Child to Parent
SELECT Id, Name, Broker__c,
Broker__r.Id,
Broker__r.Region__c
FROM Property__c
WHERE Status__c = ’Available’
[
{
"Id": "a0145000000aBf4AAE",
"Name": "82 Glen Ross Lane",
"Broker__c": "a00vn000000dU3dAAE",
"Broker__r": {
"Id": "a00vn000000dU3dAAE",
"Region__c": "North"
}
},
{
"Id": "a0145000000aBf4AAE",
"Name": "Riverside Luxury Flat",
"Broker__c": "",
"Broker__r": {...}
}, ...
]
Relationship Query: Parent to Child
SELECT Id, Name, Region__c,
(SELECT Id, Name, Status__c
FROM Properties__r)
FROM Broker__c
WHERE Region__c = 'North'
[{
"Id": "a00vn000000dU3dAAE",
"Name": "Shelley Levene",
"Region__c": "North,
"Properties__r": [
{
"Id": "a0145000000aBf4AAE",
"Name": "Glengarry Manor",
"Status__c": "Available"
},
{
"Id": "a0145000000aBd4AAE",
"Name": "82 Glen Ross Lane",
"Status__c": "Closed"
}
]
}, ...]
Querying for Intersection
Select Id, Name,
Broker__r.Name,
Broker__r.Email__c
FROM Property__c
WHERE
Broker__r.Region__c = 'North'
[
{
"Id": "a0145000000aBf4AAE",
"Name": "83 Glen Ross Lane",
"Broker__r": {
"Name": "Shelley Levene",
"Email__c":"shel@machine.com"
}
},
{...},
...
]
Aggregate Queries
SELECT
City__c,
COUNT(Id) houseCount,
MAX(Price__c) maxValue,
AVG(Price__c) avgValue
FROM Property__c
GROUP BY City__c
[
{
"City__c": "Reading",
"houseCount": 81,
"maxValue": 748000,
"avgValue": 569468.50
},
{
"City__c": "Windsor",
"houseCount": 46,
"maxValue": 840000,
"avgValue": 638812.50
},
...
]
Demo
Find the total property value currently on the market
broken down by each broker region
Recap
▪ Data Model &
Relationships
– Much that looks similar, but
– Many important differences
– Predefined Join
– Relationship Types
▪ Relationships & SOQL
– SOQL has relations but is
not “relational”
– Limits cannot be ignored
– Good design principles still
apply but check your
assumptions
Concepts to Explore Further
▪ Query Locator: database cursor abstraction
▪ Query Optimizer: translates SOQL to SQL
▪ Query Plan: examine query optimizer behavior
Read More
▪ Blog: Basic SOQL Relationship Queries: http://bit.ly/soqlrelationship
▪ SOQL-SOSL Guide http://bit.ly/soqlsosl
▪ Sharing http://bit.ly/sharingarch
▪ Limits http://bit.ly/apexgovlim
▪ Multi-Tenant Architecture http://bit.ly/sfmultiten
Q & A
Try Trailhead: trailhead.salesforce.com
Join the conversation: @salesforcedevs
Thank You

Weitere ähnliche Inhalte

Was ist angesagt?

Lwc presentation
Lwc presentationLwc presentation
Lwc presentationNithesh N
 
Introduction to the Salesforce Security Model
Introduction to the Salesforce Security ModelIntroduction to the Salesforce Security Model
Introduction to the Salesforce Security ModelSalesforce Developers
 
Understanding the Salesforce Architecture: How We Do the Magic We Do
Understanding the Salesforce Architecture: How We Do the Magic We DoUnderstanding the Salesforce Architecture: How We Do the Magic We Do
Understanding the Salesforce Architecture: How We Do the Magic We DoSalesforce Developers
 
Build Apps Visually with Lightning App Builder
Build Apps Visually with Lightning App BuilderBuild Apps Visually with Lightning App Builder
Build Apps Visually with Lightning App BuilderSalesforce Developers
 
Introduction to apex code
Introduction to apex codeIntroduction to apex code
Introduction to apex codeEdwinOstos
 
Webinar: Take Control of Your Org with Salesforce Optimizer
Webinar: Take Control of Your Org with Salesforce OptimizerWebinar: Take Control of Your Org with Salesforce Optimizer
Webinar: Take Control of Your Org with Salesforce OptimizerSalesforce Admins
 
Introduction to lightning components
Introduction to lightning componentsIntroduction to lightning components
Introduction to lightning componentsMohith Shrivastava
 
LWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura InteroperabilityLWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura InteroperabilitySalesforce Developers
 
Apex Enterprise Patterns: Building Strong Foundations
Apex Enterprise Patterns: Building Strong FoundationsApex Enterprise Patterns: Building Strong Foundations
Apex Enterprise Patterns: Building Strong FoundationsSalesforce Developers
 
Triggers and order of execution1
Triggers and order of execution1Triggers and order of execution1
Triggers and order of execution1Prabhakar Sharma
 
Migrating Visualforce Pages to Lightning
Migrating Visualforce Pages to LightningMigrating Visualforce Pages to Lightning
Migrating Visualforce Pages to LightningSalesforce Developers
 
Build Reliable Asynchronous Code with Queueable Apex
Build Reliable Asynchronous Code with Queueable ApexBuild Reliable Asynchronous Code with Queueable Apex
Build Reliable Asynchronous Code with Queueable ApexSalesforce Developers
 
How to create a developer org for salesforce
How to create a developer org for salesforceHow to create a developer org for salesforce
How to create a developer org for salesforceMyGuide By Edcast
 
Microservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring CloudMicroservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring CloudEberhard Wolff
 
An introduction to Salesforce
An introduction to SalesforceAn introduction to Salesforce
An introduction to Salesforcevaluebound
 
A Separation of Concerns: Clean Architecture on Android
A Separation of Concerns: Clean Architecture on AndroidA Separation of Concerns: Clean Architecture on Android
A Separation of Concerns: Clean Architecture on AndroidOutware Mobile
 

Was ist angesagt? (20)

Lwc presentation
Lwc presentationLwc presentation
Lwc presentation
 
Introduction to the Salesforce Security Model
Introduction to the Salesforce Security ModelIntroduction to the Salesforce Security Model
Introduction to the Salesforce Security Model
 
Understanding the Salesforce Architecture: How We Do the Magic We Do
Understanding the Salesforce Architecture: How We Do the Magic We DoUnderstanding the Salesforce Architecture: How We Do the Magic We Do
Understanding the Salesforce Architecture: How We Do the Magic We Do
 
Build Apps Visually with Lightning App Builder
Build Apps Visually with Lightning App BuilderBuild Apps Visually with Lightning App Builder
Build Apps Visually with Lightning App Builder
 
Introduction to apex code
Introduction to apex codeIntroduction to apex code
Introduction to apex code
 
Introduction to Apex Triggers
Introduction to Apex TriggersIntroduction to Apex Triggers
Introduction to Apex Triggers
 
Building APIs with Mule and Spring Boot
Building APIs with Mule and Spring BootBuilding APIs with Mule and Spring Boot
Building APIs with Mule and Spring Boot
 
Webinar: Take Control of Your Org with Salesforce Optimizer
Webinar: Take Control of Your Org with Salesforce OptimizerWebinar: Take Control of Your Org with Salesforce Optimizer
Webinar: Take Control of Your Org with Salesforce Optimizer
 
Introduction to lightning components
Introduction to lightning componentsIntroduction to lightning components
Introduction to lightning components
 
LWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura InteroperabilityLWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura Interoperability
 
Apex Enterprise Patterns: Building Strong Foundations
Apex Enterprise Patterns: Building Strong FoundationsApex Enterprise Patterns: Building Strong Foundations
Apex Enterprise Patterns: Building Strong Foundations
 
Triggers and order of execution1
Triggers and order of execution1Triggers and order of execution1
Triggers and order of execution1
 
Migrating Visualforce Pages to Lightning
Migrating Visualforce Pages to LightningMigrating Visualforce Pages to Lightning
Migrating Visualforce Pages to Lightning
 
Build Reliable Asynchronous Code with Queueable Apex
Build Reliable Asynchronous Code with Queueable ApexBuild Reliable Asynchronous Code with Queueable Apex
Build Reliable Asynchronous Code with Queueable Apex
 
How to create a developer org for salesforce
How to create a developer org for salesforceHow to create a developer org for salesforce
How to create a developer org for salesforce
 
Microservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring CloudMicroservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring Cloud
 
An introduction to Salesforce
An introduction to SalesforceAn introduction to Salesforce
An introduction to Salesforce
 
Introduction to Visualforce
Introduction to VisualforceIntroduction to Visualforce
Introduction to Visualforce
 
A Separation of Concerns: Clean Architecture on Android
A Separation of Concerns: Clean Architecture on AndroidA Separation of Concerns: Clean Architecture on Android
A Separation of Concerns: Clean Architecture on Android
 
Introduction to Apex for Developers
Introduction to Apex for DevelopersIntroduction to Apex for Developers
Introduction to Apex for Developers
 

Ähnlich wie Modeling and Querying Data and Relationships in Salesforce

Salesforce1 Platform: Data Model, Relationships and Queries Webinar
Salesforce1 Platform: Data Model, Relationships and Queries WebinarSalesforce1 Platform: Data Model, Relationships and Queries Webinar
Salesforce1 Platform: Data Model, Relationships and Queries WebinarSalesforce Developers
 
Mbf2 salesforce webinar 2
Mbf2 salesforce webinar 2Mbf2 salesforce webinar 2
Mbf2 salesforce webinar 2BeMyApp
 
Salesforce1 lightning dev week UYSDUG 2015 - Lightning Connect
Salesforce1 lightning dev week UYSDUG 2015 - Lightning ConnectSalesforce1 lightning dev week UYSDUG 2015 - Lightning Connect
Salesforce1 lightning dev week UYSDUG 2015 - Lightning ConnectAldo Fernandez
 
Visualforce Hack for Junction Objects
Visualforce Hack for Junction ObjectsVisualforce Hack for Junction Objects
Visualforce Hack for Junction ObjectsRitesh Aswaney
 
Building Apps Faster with Lightning and Winter '17
Building Apps Faster with Lightning and Winter '17Building Apps Faster with Lightning and Winter '17
Building Apps Faster with Lightning and Winter '17Mark Adcock
 
Building apps faster with lightning and winter '17
Building apps faster with lightning and winter '17Building apps faster with lightning and winter '17
Building apps faster with lightning and winter '17Salesforce Developers
 
Moving Sharing to a Parallel Architecture
Moving Sharing to a Parallel ArchitectureMoving Sharing to a Parallel Architecture
Moving Sharing to a Parallel ArchitectureSalesforce Developers
 
Demystify Metadata Relationships with the Dependency API
Demystify Metadata Relationships with the Dependency APIDemystify Metadata Relationships with the Dependency API
Demystify Metadata Relationships with the Dependency APIDeveloper Force
 
Pardot Story: Beyond List Email
Pardot Story: Beyond List EmailPardot Story: Beyond List Email
Pardot Story: Beyond List EmailPardot
 
The Power of Salesforce APIs World Tour Edition
The Power of Salesforce APIs World Tour EditionThe Power of Salesforce APIs World Tour Edition
The Power of Salesforce APIs World Tour EditionPeter Chittum
 
Data.com APIs in Action ? Bringing Data to Life in Salesforce
Data.com APIs in Action ? Bringing Data to Life in SalesforceData.com APIs in Action ? Bringing Data to Life in Salesforce
Data.com APIs in Action ? Bringing Data to Life in SalesforceSalesforce Developers
 
Save Millions of Clicks! Easily migrate complex schemas from SQL to Salesforce.
Save Millions of Clicks!  Easily migrate complex schemas from SQL to Salesforce.Save Millions of Clicks!  Easily migrate complex schemas from SQL to Salesforce.
Save Millions of Clicks! Easily migrate complex schemas from SQL to Salesforce.Daniel Peter
 
CodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local DevelopmentCodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local DevelopmentSalesforce Developers
 
Integrating with salesforce
Integrating with salesforceIntegrating with salesforce
Integrating with salesforceMark Adcock
 
Exploring SQL Server Azure Database Relationships Using Lightning Connect
Exploring SQL Server Azure Database Relationships Using Lightning ConnectExploring SQL Server Azure Database Relationships Using Lightning Connect
Exploring SQL Server Azure Database Relationships Using Lightning ConnectSalesforce Developers
 
Cutting Edge Mobile Development in the App Cloud
Cutting Edge Mobile Development in the App CloudCutting Edge Mobile Development in the App Cloud
Cutting Edge Mobile Development in the App CloudSalesforce Developers
 
Known and unknown Salesforce Marketing Cloud limitations… and some workaround...
Known and unknown Salesforce Marketing Cloud limitations… and some workaround...Known and unknown Salesforce Marketing Cloud limitations… and some workaround...
Known and unknown Salesforce Marketing Cloud limitations… and some workaround...CzechDreamin
 
Force.com Integration Using Web Services With .NET & PHP Apps
Force.com Integration Using Web Services With .NET & PHP AppsForce.com Integration Using Web Services With .NET & PHP Apps
Force.com Integration Using Web Services With .NET & PHP AppsSalesforce Developers
 
Building Visualforce Custom Events Handlers
Building Visualforce Custom Events HandlersBuilding Visualforce Custom Events Handlers
Building Visualforce Custom Events HandlersSalesforce Developers
 

Ähnlich wie Modeling and Querying Data and Relationships in Salesforce (20)

Salesforce1 Platform: Data Model, Relationships and Queries Webinar
Salesforce1 Platform: Data Model, Relationships and Queries WebinarSalesforce1 Platform: Data Model, Relationships and Queries Webinar
Salesforce1 Platform: Data Model, Relationships and Queries Webinar
 
Mbf2 salesforce webinar 2
Mbf2 salesforce webinar 2Mbf2 salesforce webinar 2
Mbf2 salesforce webinar 2
 
Salesforce1 lightning dev week UYSDUG 2015 - Lightning Connect
Salesforce1 lightning dev week UYSDUG 2015 - Lightning ConnectSalesforce1 lightning dev week UYSDUG 2015 - Lightning Connect
Salesforce1 lightning dev week UYSDUG 2015 - Lightning Connect
 
Visualforce Hack for Junction Objects
Visualforce Hack for Junction ObjectsVisualforce Hack for Junction Objects
Visualforce Hack for Junction Objects
 
Building Apps Faster with Lightning and Winter '17
Building Apps Faster with Lightning and Winter '17Building Apps Faster with Lightning and Winter '17
Building Apps Faster with Lightning and Winter '17
 
Building apps faster with lightning and winter '17
Building apps faster with lightning and winter '17Building apps faster with lightning and winter '17
Building apps faster with lightning and winter '17
 
Moving Sharing to a Parallel Architecture
Moving Sharing to a Parallel ArchitectureMoving Sharing to a Parallel Architecture
Moving Sharing to a Parallel Architecture
 
Demystify Metadata Relationships with the Dependency API
Demystify Metadata Relationships with the Dependency APIDemystify Metadata Relationships with the Dependency API
Demystify Metadata Relationships with the Dependency API
 
Pardot Story: Beyond List Email
Pardot Story: Beyond List EmailPardot Story: Beyond List Email
Pardot Story: Beyond List Email
 
The Power of Salesforce APIs World Tour Edition
The Power of Salesforce APIs World Tour EditionThe Power of Salesforce APIs World Tour Edition
The Power of Salesforce APIs World Tour Edition
 
Data.com APIs in Action ? Bringing Data to Life in Salesforce
Data.com APIs in Action ? Bringing Data to Life in SalesforceData.com APIs in Action ? Bringing Data to Life in Salesforce
Data.com APIs in Action ? Bringing Data to Life in Salesforce
 
Introduction to Force.com
Introduction to Force.comIntroduction to Force.com
Introduction to Force.com
 
Save Millions of Clicks! Easily migrate complex schemas from SQL to Salesforce.
Save Millions of Clicks!  Easily migrate complex schemas from SQL to Salesforce.Save Millions of Clicks!  Easily migrate complex schemas from SQL to Salesforce.
Save Millions of Clicks! Easily migrate complex schemas from SQL to Salesforce.
 
CodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local DevelopmentCodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local Development
 
Integrating with salesforce
Integrating with salesforceIntegrating with salesforce
Integrating with salesforce
 
Exploring SQL Server Azure Database Relationships Using Lightning Connect
Exploring SQL Server Azure Database Relationships Using Lightning ConnectExploring SQL Server Azure Database Relationships Using Lightning Connect
Exploring SQL Server Azure Database Relationships Using Lightning Connect
 
Cutting Edge Mobile Development in the App Cloud
Cutting Edge Mobile Development in the App CloudCutting Edge Mobile Development in the App Cloud
Cutting Edge Mobile Development in the App Cloud
 
Known and unknown Salesforce Marketing Cloud limitations… and some workaround...
Known and unknown Salesforce Marketing Cloud limitations… and some workaround...Known and unknown Salesforce Marketing Cloud limitations… and some workaround...
Known and unknown Salesforce Marketing Cloud limitations… and some workaround...
 
Force.com Integration Using Web Services With .NET & PHP Apps
Force.com Integration Using Web Services With .NET & PHP AppsForce.com Integration Using Web Services With .NET & PHP Apps
Force.com Integration Using Web Services With .NET & PHP Apps
 
Building Visualforce Custom Events Handlers
Building Visualforce Custom Events HandlersBuilding Visualforce Custom Events Handlers
Building Visualforce Custom Events Handlers
 

Mehr von Salesforce Developers

Sample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce DevelopersSample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce DevelopersSalesforce Developers
 
Maximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceMaximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceSalesforce Developers
 
Local development with Open Source Base Components
Local development with Open Source Base ComponentsLocal development with Open Source Base Components
Local development with Open Source Base ComponentsSalesforce Developers
 
TrailheaDX India : Developer Highlights
TrailheaDX India : Developer HighlightsTrailheaDX India : Developer Highlights
TrailheaDX India : Developer HighlightsSalesforce Developers
 
Why developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX IndiaWhy developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX IndiaSalesforce Developers
 
CodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web ComponentsCodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web ComponentsSalesforce Developers
 
Enterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web ComponentsEnterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web ComponentsSalesforce Developers
 
TrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer HighlightsTrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer HighlightsSalesforce Developers
 
Lightning web components - Episode 4 : Security and Testing
Lightning web components  - Episode 4 : Security and TestingLightning web components  - Episode 4 : Security and Testing
Lightning web components - Episode 4 : Security and TestingSalesforce Developers
 
Lightning web components episode 2- work with salesforce data
Lightning web components   episode 2- work with salesforce dataLightning web components   episode 2- work with salesforce data
Lightning web components episode 2- work with salesforce dataSalesforce Developers
 
Lightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An IntroductionLightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An IntroductionSalesforce Developers
 
Migrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCPMigrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCPSalesforce Developers
 
Scale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in SalesforceScale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in SalesforceSalesforce Developers
 
Replicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data CaptureReplicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data CaptureSalesforce Developers
 
Modern Development with Salesforce DX
Modern Development with Salesforce DXModern Development with Salesforce DX
Modern Development with Salesforce DXSalesforce Developers
 
Integrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS ConnectIntegrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS ConnectSalesforce Developers
 
Modern App Dev: Modular Development Strategies
Modern App Dev: Modular Development StrategiesModern App Dev: Modular Development Strategies
Modern App Dev: Modular Development StrategiesSalesforce Developers
 

Mehr von Salesforce Developers (20)

Sample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce DevelopersSample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce Developers
 
Maximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceMaximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component Performance
 
Local development with Open Source Base Components
Local development with Open Source Base ComponentsLocal development with Open Source Base Components
Local development with Open Source Base Components
 
TrailheaDX India : Developer Highlights
TrailheaDX India : Developer HighlightsTrailheaDX India : Developer Highlights
TrailheaDX India : Developer Highlights
 
Why developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX IndiaWhy developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX India
 
CodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web ComponentsCodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web Components
 
Enterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web ComponentsEnterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web Components
 
TrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer HighlightsTrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer Highlights
 
Live coding with LWC
Live coding with LWCLive coding with LWC
Live coding with LWC
 
Lightning web components - Episode 4 : Security and Testing
Lightning web components  - Episode 4 : Security and TestingLightning web components  - Episode 4 : Security and Testing
Lightning web components - Episode 4 : Security and Testing
 
Lightning web components episode 2- work with salesforce data
Lightning web components   episode 2- work with salesforce dataLightning web components   episode 2- work with salesforce data
Lightning web components episode 2- work with salesforce data
 
Lightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An IntroductionLightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An Introduction
 
Migrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCPMigrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCP
 
Scale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in SalesforceScale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in Salesforce
 
Replicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data CaptureReplicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data Capture
 
Modern Development with Salesforce DX
Modern Development with Salesforce DXModern Development with Salesforce DX
Modern Development with Salesforce DX
 
Get Into Lightning Flow Development
Get Into Lightning Flow DevelopmentGet Into Lightning Flow Development
Get Into Lightning Flow Development
 
Integrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS ConnectIntegrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS Connect
 
Introduction to MuleSoft
Introduction to MuleSoftIntroduction to MuleSoft
Introduction to MuleSoft
 
Modern App Dev: Modular Development Strategies
Modern App Dev: Modular Development StrategiesModern App Dev: Modular Development Strategies
Modern App Dev: Modular Development Strategies
 

Kürzlich hochgeladen

Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptxVinzoCenzo
 
Data modeling 101 - Basics - Software Domain
Data modeling 101 - Basics - Software DomainData modeling 101 - Basics - Software Domain
Data modeling 101 - Basics - Software DomainAbdul Ahad
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogueitservices996
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingShane Coughlan
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfRTS corp
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdfAndrey Devyatkin
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxRTS corp
 
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfPros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfkalichargn70th171
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...OnePlan Solutions
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesKrzysztofKkol1
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...OnePlan Solutions
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingShane Coughlan
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsJean Silva
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonApplitools
 

Kürzlich hochgeladen (20)

Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptx
 
Data modeling 101 - Basics - Software Domain
Data modeling 101 - Basics - Software DomainData modeling 101 - Basics - Software Domain
Data modeling 101 - Basics - Software Domain
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogue
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
 
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfPros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero results
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
 

Modeling and Querying Data and Relationships in Salesforce

  • 2. Forward-Looking Statement 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.
  • 3. Go Social! Salesforce Developers Salesforce Developers Salesforce Developers The video will be posted to YouTube & the webinar recap page (same URL as registration).This webinar is being recorded! @salesforcedevs / #forcewebinar
  • 4. ▪ Don’t wait until the end to ask your question! – Technical support will answer questions starting now. ▪ Respect Q&A etiquette – Please don’t repeat questions. The support team is working their way down the queue. ▪ Stick around for live Q&A at the end – Speakers will tackle more questions at the end, time- allowing. ▪ Head to Developer Forums – More questions? Visit developer.salesforce.com/forums Have Questions?
  • 5. SOQL for the SQL Developer Look for the blog post: http://bit.ly/soql4sql
  • 6. Agenda ▪ Data Model & Relationships – Comparing Force.com with Relational DBMS – Relationship Types & the Predefined Join ▪ Relationships & SOQL – SOQL vs SQL – Relationship Queries
  • 7. Assumptions ▪ A basic understanding of the Force.com Platform including: – Creating Custom Objects and Fields – Navigating the UI ▪ Knowledge of relational database concepts – Tables – Primary/Foreign Keys – Joins
  • 8. Agenda ▪ Data Model & Relationships ▪ Relationships & SOQL
  • 9. Data Model and the Force.com Platform ▪ SObject: – Table-like data structure • Records • Fields – Extensible – Queryable/Updatable – Relationships
  • 10. SObjects Drive Customization Property__c Broker__c Desktop Mobile Business Process Reporting Security Model and Sharing /SObjects/Property__c APIs Programmatic Customization Broker__c brkr = new Broker__c();
  • 11. Standard Data Model ▪ Standard Objects – Account – Contact – Lead – Opportunity – Case – … ▪ Standard Fields – Id – Name – CreatedBy/Date – LastModifiedBy/Date – OwnerId – IsDeleted – …
  • 12. Extensible Data Model ▪ Custom Objects – Property__c – Broker__c – Favorite__c – … ▪ Custom Fields – Status__c – City__c – Baths__c – Beds__c – Mobile_Phone__c – …
  • 13. Relationships: The Predefined Join ▪ RDBMS – Design: Constraint – Runtime: Query with Join ▪ Force.com – Design: Constraint and Join – Runtime: Relationship Query
  • 14. Master-DetailLookup Relationship Types NeverOptional Cascade Clear Field/Block/Cascade* Nullability Delete Behavior Child Inherits from ParentIndependent Parent/Child 225 Record Sharing Access Max Allowed Fields
  • 15. Demo Dreamhouse App Property and Broker Relationship developer.salesforce.com/dreamhouse
  • 16. Agenda ▪ Data Model & Relationships ▪ Relationships & SOQL
  • 17. 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, Streaming, etc.…)
  • 18. From SQL to SOQL ▪ At first may look familiar ▪ Important differences ▪ Learn the differences ▪ Use good data design practices
  • 19. From SQL to SOQL: The Familiar Bits ▪ Table-like structure ▪ Similar query syntax ▪ Indexed ▪ Transactional ▪ Triggers SELECT Id, Name, Status__c FROM Property__c WHERE Beds__c > 2
  • 20. From SQL to SOQL: Immediate Differences ▪ No select * ▪ No views ▪ SOQL is read-only ▪ Limited indexes ▪ Object-relational mapping is automatic ▪ Schema changes protected
  • 21. 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
  • 22. The __c and __r Suffixes Broker__c Property__c Id Id Broker__c Broker__r Properties__r Type: List<Property__c> Type: Id Type: Broker__c 1-M
  • 23. Relationship Query: Child to Parent SELECT Id, Name, Broker__c, Broker__r.Id, Broker__r.Region__c FROM Property__c WHERE Status__c = ’Available’ [ { "Id": "a0145000000aBf4AAE", "Name": "82 Glen Ross Lane", "Broker__c": "a00vn000000dU3dAAE", "Broker__r": { "Id": "a00vn000000dU3dAAE", "Region__c": "North" } }, { "Id": "a0145000000aBf4AAE", "Name": "Riverside Luxury Flat", "Broker__c": "", "Broker__r": {...} }, ... ]
  • 24. Relationship Query: Parent to Child SELECT Id, Name, Region__c, (SELECT Id, Name, Status__c FROM Properties__r) FROM Broker__c WHERE Region__c = 'North' [{ "Id": "a00vn000000dU3dAAE", "Name": "Shelley Levene", "Region__c": "North, "Properties__r": [ { "Id": "a0145000000aBf4AAE", "Name": "Glengarry Manor", "Status__c": "Available" }, { "Id": "a0145000000aBd4AAE", "Name": "82 Glen Ross Lane", "Status__c": "Closed" } ] }, ...]
  • 25. Querying for Intersection Select Id, Name, Broker__r.Name, Broker__r.Email__c FROM Property__c WHERE Broker__r.Region__c = 'North' [ { "Id": "a0145000000aBf4AAE", "Name": "83 Glen Ross Lane", "Broker__r": { "Name": "Shelley Levene", "Email__c":"shel@machine.com" } }, {...}, ... ]
  • 26. Aggregate Queries SELECT City__c, COUNT(Id) houseCount, MAX(Price__c) maxValue, AVG(Price__c) avgValue FROM Property__c GROUP BY City__c [ { "City__c": "Reading", "houseCount": 81, "maxValue": 748000, "avgValue": 569468.50 }, { "City__c": "Windsor", "houseCount": 46, "maxValue": 840000, "avgValue": 638812.50 }, ... ]
  • 27. Demo Find the total property value currently on the market broken down by each broker region
  • 28. Recap ▪ Data Model & Relationships – Much that looks similar, but – Many important differences – Predefined Join – Relationship Types ▪ Relationships & SOQL – SOQL has relations but is not “relational” – Limits cannot be ignored – Good design principles still apply but check your assumptions
  • 29. Concepts to Explore Further ▪ Query Locator: database cursor abstraction ▪ Query Optimizer: translates SOQL to SQL ▪ Query Plan: examine query optimizer behavior
  • 30. Read More ▪ Blog: Basic SOQL Relationship Queries: http://bit.ly/soqlrelationship ▪ SOQL-SOSL Guide http://bit.ly/soqlsosl ▪ Sharing http://bit.ly/sharingarch ▪ Limits http://bit.ly/apexgovlim ▪ Multi-Tenant Architecture http://bit.ly/sfmultiten
  • 31.
  • 32.
  • 33.
  • 34.
  • 35. Q & A Try Trailhead: trailhead.salesforce.com Join the conversation: @salesforcedevs