SlideShare uma empresa Scribd logo
1 de 42
The Force.com Coding Tour
Kieren Jameson
Digital Solutions Manager (ETR)
Salesforce MVP
@KierenJameson
WomenCodeHeroes.com
Decoding Coding for Awesome Admins
Angela Mahoney
Cat Herder (iCloudSalesforce)
Salesforce MVP
@icloudsf
icloudsalesforce.com
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.
Safe Harbor
Kieren Jameson Angela Mahoney
@kierenjameson
WomenCodeHeroes.com
RAD Women Co-Founder
ETR Digital Solutions Manager
@icloudsf
icloudsalesforce.com
forcelandia.com
Portland Developers Group
Portland Girly Geeks Group
RAD Women Co-Founder
FORCE.COM
DEVELOPER
SALESFORCE
ADMINISTRATOR
ADVANCED
ADMINISTRATOR
SALESCLOUD
CONSULTANT
FORCE.COM
DEVELOPER
 You'll understand why you should know what is
going on with code, even if you don't want to
write code yourself.
 You'll understand what your options are for
process automation: clicks vs code.
 You'll begin to understand the seven basic
building blocks of force.com coding.
 You'll see some code in action!
 You'll get further resources to learn code.
What will you walk away with today?
 Because there are
some things you
can’t do with clicks.
 If you work with
developers, it’s
helpful to know what
they are talking
about.
 Because we’re
admins–there's
nothing we can’t do!
But why is code so hard?
 Because developer documentation is very
“developer-y” and is sometimes (often!)
hard to understand for non-coders.
 Because the first (and trickiest)
part of learning about code
is understanding what the
heck the building blocks
are and hew they related
to what you already know.
Why should you care about code?
Photo Source:
http://bit.ly/1UPStiM
CLICKS (Declarative)
 Formula Fields
 Validation Rules
 Workflow Rules
 Visual Workflow
 Approval Processes
 Lightning Process Builder
CODE (Programmatic)
Apex Classes & Apex Triggers
 If you want to create/update records are not related to the
object that you are working with.
 Run processes that need a particular order of operation
(workflows are triggered randomly).
 When you want to create complex business logic that doesn’t
require user intervention, including if you have a bunch of
workflow rules that run on a single object.
When to “Click” and when to “Code”?
If you can do it with clicks then generally you should.
1. If you wanted to add a follow-up Task every time a new “hot” Account was
created and assign it to the owner of the Account?
Quick Quiz! – Clicks or Code?
1. If you wanted to add a follow-up Task every time a new “hot” Account was
created and assign it to the owner of the Account?
CLICKS!
Quick Quiz! – Clicks or Code?
1. If you wanted to add a follow-up Task every time a new “hot” Account was
created and assign it to the owner of the Account? CLICKS!
2. If you wanted to add a follow-up Task every time a new “hot” Account was
created and assign it to your top Sales Person from the previous FQ?
Quick Quiz! – Clicks or Code?
1. If you wanted to add a follow-up Task every time a new “hot” Account was
created and assign it to the owner of the Account? CLICKS!
2. If you wanted to add a follow-up Task every time a new “hot” Account was
created and assign it to your top Sales Person from the previous FQ?
CODE!
Quick Quiz! – Clicks or Code?
Basic Apex Building Blocks
 Classes: the "Archetypes"
 Objects: the "Individuals"
 Methods: the "Doers"
 Variables: the "Collectors"
Getting Data In & Out of Salesforce
 DML: the "Courier"
 SOQL: the "Researcher"
Putting it all together
 Triggers: the "Listeners"
What are we decoding today?
Force.com Code Tour Itinerary
 Classes are blueprints or templates for
the “stuff” that we’re working with.
 Classes are like Objects in Salesforce
 They know stuff about themselves
(these are their variables)
 They can do things (these are their
methods)
Variables
First Name, Last Name,
Birthday, Age, Record
ID, Favorite Pastime,
is Tacky?, Annoyance
Rating…
Classes – the “Architypes”
Methods
Eat, Drink, Snorkel,
Ride Horses, Sightsee,
Take Photos, Complain,
Talk Loudly, Tip Poorly,
Be Annoying …
 Apex objects are like Salesforce records.
 Objects are what we create from classes.
 If a class is a template for an tourist, then
an object is an actual, individual person.
Objects – The “Individuals”
The Tourista Family!
Instances of the
Tourist Class
(aka Objects)
These are
objects
Photo Credit: http://bit.ly/1JnkRXD
Tessa Tourista
Force.com/Apex Salesforce Examples
Basic Apex
Building Blocks
Class The Architype Salesforce Contact Object
Object The Individual Individual Contact Record
*These are loose translations
Your Force.com Decoder Ring
 Variables are like luggage…they are reusable
containers to hold things (data)
 They come in different shapes and sizes to
store different types of things: small, large, and
specialty shapes (e.g., hats, golf clubs)
 They have a data type, a name, and a value.
Variables – The “Collectors”
The type of Luggage
(e.g., small case)
(data type)
mySuitcase
(variable name)
what
mySuitcase
contains
(value)
String mySuitcase = 'Full of Stuff';
data type name value
Force.com/Apex
Data Types
Salesforce Field Type
String Text, Text Areas, Auto Number, Url, Phone, Email
Integer or Decimal Number, Percent, Currency
Boolean Checkbox
ID ID of a Salesforce Record
Date, DateTime Date, DateTime
Your Force.com Field/Data Type Decoder Ring
String firstName = 'Tessa';
String lastName = 'Tourista';
Integer numTours = 0;
Decimal height = 5.4;
Date birthdate = '1983-02-01';
Boolean isTacky = TRUE;
String tipLevel = 'Generous';
ID id = '00300000003S5PGBC0';
Tessa Tourista’s Variables
typeOfVariable myContainer = contentsOfContainer;
data type name value
Photo Credit: http://bit.ly/1JnkRXD
Tessa
Tourista
 Methods are the things
that objects and classes
can do.
 They have a name and can
be passed arguments
(values) that can be used
inside the method.
Methods – The “Doers” Snorkeling
Building
sand
castles
Sunbathing
Photo source: http://i.huffpost.com/gen/2062638/images/o-TACKY-
TOURIST-facebook.jpg
What to wear snorkeling!
+ OR
We have our fins,
snorkel, and mask.
But how do we decide
what else to wear?
Using the method
Defining what the
method does
What to wear snorkeling!
Shorty wetsuit
66-72◦F
What to wear snorkeling!
Over 72◦F
Bathing suit
Full wetsuit
Under 66◦F
Shorty wetsuit
66-72◦F
Full wetsuit
Under 66◦F
What to wear snorkeling!
Over 72◦F
Bathing suit
What should
Tessa wear?
Full wetsuit
Under 66◦F
What to wear snorkeling!
Shorty wetsuit
66-72◦F
Bathing
Suit Time!
Not true
Not true
75◦F
Demo Time: Code in ACTION!!
Photo Source: https://www.flickr.com/photos/raneko/5198682308
Force.com/Apex Salesforce Examples
Basic Apex
Building Blocks
Class The Architype Salesforce Contact Object
Object The Individual Individual Contact Record
Variable The Collector Contact Field
Method The Do-er Workflow Action*
*These are loose translations
Your Force.com Decoder Ring
DML – The “Courier” SOQL– The “Researcher”
Database Manipulation Language
DML pushes record changes to Salesforce
DML
Salesforce Object Query Language
SOQL pulls records from Salesforce
SOQL
DML – The “Courier”
DML is used to send
data to Salesforce
 Insert
 Update
 Upsert
 Delete
 Undelete
DML
DATA PACKAGE
DML
SOQL – The “Researcher”
SOQL is used to pull data from Salesforce
It can do a LOT, but at minimum, SOQL
has 3 basic pieces:
 SELECT – what fields are you want to see
 FROM – the Salesforce object that contains
these fields
 WHERE – any filters on the data
SOQL
Demo Time: Code in ACTION!!Photo Source: http://hdwallpapersbase.com/wp-content/uploads/2013/01/Husky-Puppy-Wallpaper1.jpg
Force.com/Apex Salesforce Examples
Basic Apex
Building Blocks
Class The Architype Salesforce Contact Object
Object The Individual Individual Contact Record
Variable The Collector Contact Field
Method The Do-er Workflow Action*
Get Data In &
Out of Salesforce
DML The Courier Save Button*
SOQL Query The Researcher Tabular Report*
*These are loose translations
Your Force.com Decoder Ring
Photo credit: Melvin Gaal (Mindsharing.eu) / Foter.com
 Triggers kick off code-based
automated processes.
 They listen for certain database
events (e.g., a record being
inserted, updated, etc.).
 They either link to or contain the
code that makes the magic
happen.
This lets us do things like…
 Compare data before & after
a change is made.
 Create new, and update
existing, related records.
 Interact with external data
and web services
(e.g., external databases &
SMS text message services)
Triggers– the “Listeners”
Trigger Example (avoid double booking)
 We have tours and we have tourists.
 Tourists can only be on one tour at a time.
 Need something to double-check that we're
not double booking tourists.
Step 1: Try to add a tourist Contact
to a tour.
Step 2: Find out what other tours this
contact is already booked on.
Step 3: Compare the start date of the
tours that the person is already on with
the start date of the tour we want to add
them to.
Step 4: If the tour you want to add
them to conflicts with the dates of their
existing tours, then give an error
message and don't let us book the tour.
????
What does this look like in code?
???
//1. When we try and add or update a tourparticipants__c
record, then before you commit the data to the database
run this trigger.
trigger RejectTourDoubleBooking on TourParticipants__c
(before insert, before update) {
//2. Create a list of all the records (called TPs for "Tour
Participants") that we sent to the trigger. Then loop over
all these records, and for each one run some code.
for (TourParticipants__c TPs : trigger.new) {
//3. For each item in the TP list, create another list (called
tour) that gets the ID and the start date of the tour we
are wanting to add the contact to.
Tour__c tour =
[SELECT id, startDate__c FROM Tour__c
WHERE id = :TPs.tour__c];
//4. Create another list of TourParticipant__c records
(called conflicts). Put in this list any records from the
TourParticipants__c custom object where the same
person we're wanting to add to a tour is already on a
tour with the same start date as the tour we are
wanting to add them to.
list <TourParticipants__c> conflicts =
[SELECT id FROM TourParticipants__c
WHERE contact__c = :TPs.contact__c AND
tour__r.startDate__c = :tour.startDate__c];
//5. If the "conflicts" list is NOT (!) empty, then block the
contact from being added to the tour.
if (! conflicts.isEmpty() ) {
TPs.addError('***DOUBLE BOOKING ERROR***');
}
}
}
WARNING: WE KNOW THIS CODE IS FLAWED
What does this look like in code?
???
trigger RejectTourDoubleBooking on TourParticipants__c
(before insert, before update) {
for (TourParticipants__c TPs : trigger.new) {
Tour__c tour =
[SELECT id, startDate__c FROM Tour__c
WHERE id = :TPs.tour__c];
list <TourParticipants__c> conflicts =
[SELECT id FROM TourParticipants__c
WHERE contact__c = :TPs.contact__c AND
tour__r.startDate__c = :tour.startDate__c];
if (! conflicts.isEmpty() ) {
TPs.addError('***DOUBLE BOOKING ERROR***');
}
}
}
WARNING: WE KNOW THIS CODE IS FLAWED
Demo Time: Code in ACTION!!Photo Source: https://upload.wikimedia.org/wikipedia/commons/f/ff/Cat_on_laptop_-_Just_Browsing.jpg
Force.com/Apex Salesforce Examples
Basic Apex
Building Blocks
Class The Architype Salesforce Account Object
Object The Individual Individual Account Record
Variable The Collector Account Field
Method The Do-er Workflow Action*
Get Data In &
Out of Salesforce
DML The Courier Save Button*
SOQL Query The Researcher Tabular Report*
Putting it All
Together
Triggers The Listener Workflow Rule Criteria*
*These are loose translations
Your Force.com Decoder Ring
More Admins who Code at Dreamforce
Sessions for Beginning Coders
 Intro to Apex for Admins
 Intro to Apex Triggers*
 From "Awesome Admin" to "Champion
Coder" (How to become a force.com
developer)
 Triggers for Admins: A Five-step
Framework for Creating Triggers
 Workflow Formulas as a Gateway to
Coding
The Dev Zone &
Developer Library
(Moscone West)
Hands-on Trainings
 Getting Started with
Apex Code for Admins
 Getting Started with
Visualforce for Admins
* Already happened but may have been recorded
Want to know more?
Salesforce Trailhead
Free online training and tutorials (clicks & code)
bit.ly/sfdc-trailhead
Force.com Video Training
Udacity, Pluralsight
bit.ly/apex-video-training
RAD Women
Learn to code on force.com with other women
bit.ly/rad-women
Women Code Heroes
Helping awesome admins learn to code.
Decoder ring included
WomenCodeHeroes.com
sfdc99.com
Apex coding for the 99%
sfdc99.com
Salesforce Dev Community
Tip sheets, workbooks, cookbooks,
documentation…
developer.salesforce.com
Keep the learning going in the Admin Lodge
Admin Theater
55+ Sessions by Admins for Admins!
Visit Customer-Led Demos Learn more with Trailhead!
Earn your Apex Basics & Database
badge
Share Your Feedback and Win a GoPro
Enroll in a session1 Tap the bell to take a
survey
2 3
Earn a GoPro prize entry
for each completed
survey
Questions?
Kieren Jameson
@kierenjameson
WomenCodeHeroes.com
Angela Mahoney
angela@icloudsalesforce.com
@icoudsf
Thank you

Mais conteúdo relacionado

Último

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Último (20)

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

Destaque

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 

Destaque (20)

Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 

The Force.com Coding Tour (Decoding Coding for Awesome Admins)

  • 1. The Force.com Coding Tour Kieren Jameson Digital Solutions Manager (ETR) Salesforce MVP @KierenJameson WomenCodeHeroes.com Decoding Coding for Awesome Admins Angela Mahoney Cat Herder (iCloudSalesforce) Salesforce MVP @icloudsf icloudsalesforce.com
  • 2. 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. Safe Harbor
  • 3. Kieren Jameson Angela Mahoney @kierenjameson WomenCodeHeroes.com RAD Women Co-Founder ETR Digital Solutions Manager @icloudsf icloudsalesforce.com forcelandia.com Portland Developers Group Portland Girly Geeks Group RAD Women Co-Founder FORCE.COM DEVELOPER SALESFORCE ADMINISTRATOR ADVANCED ADMINISTRATOR SALESCLOUD CONSULTANT FORCE.COM DEVELOPER
  • 4.  You'll understand why you should know what is going on with code, even if you don't want to write code yourself.  You'll understand what your options are for process automation: clicks vs code.  You'll begin to understand the seven basic building blocks of force.com coding.  You'll see some code in action!  You'll get further resources to learn code. What will you walk away with today?
  • 5.  Because there are some things you can’t do with clicks.  If you work with developers, it’s helpful to know what they are talking about.  Because we’re admins–there's nothing we can’t do! But why is code so hard?  Because developer documentation is very “developer-y” and is sometimes (often!) hard to understand for non-coders.  Because the first (and trickiest) part of learning about code is understanding what the heck the building blocks are and hew they related to what you already know. Why should you care about code? Photo Source: http://bit.ly/1UPStiM
  • 6. CLICKS (Declarative)  Formula Fields  Validation Rules  Workflow Rules  Visual Workflow  Approval Processes  Lightning Process Builder CODE (Programmatic) Apex Classes & Apex Triggers  If you want to create/update records are not related to the object that you are working with.  Run processes that need a particular order of operation (workflows are triggered randomly).  When you want to create complex business logic that doesn’t require user intervention, including if you have a bunch of workflow rules that run on a single object. When to “Click” and when to “Code”? If you can do it with clicks then generally you should.
  • 7. 1. If you wanted to add a follow-up Task every time a new “hot” Account was created and assign it to the owner of the Account? Quick Quiz! – Clicks or Code?
  • 8. 1. If you wanted to add a follow-up Task every time a new “hot” Account was created and assign it to the owner of the Account? CLICKS! Quick Quiz! – Clicks or Code?
  • 9. 1. If you wanted to add a follow-up Task every time a new “hot” Account was created and assign it to the owner of the Account? CLICKS! 2. If you wanted to add a follow-up Task every time a new “hot” Account was created and assign it to your top Sales Person from the previous FQ? Quick Quiz! – Clicks or Code?
  • 10. 1. If you wanted to add a follow-up Task every time a new “hot” Account was created and assign it to the owner of the Account? CLICKS! 2. If you wanted to add a follow-up Task every time a new “hot” Account was created and assign it to your top Sales Person from the previous FQ? CODE! Quick Quiz! – Clicks or Code?
  • 11. Basic Apex Building Blocks  Classes: the "Archetypes"  Objects: the "Individuals"  Methods: the "Doers"  Variables: the "Collectors" Getting Data In & Out of Salesforce  DML: the "Courier"  SOQL: the "Researcher" Putting it all together  Triggers: the "Listeners" What are we decoding today? Force.com Code Tour Itinerary
  • 12.  Classes are blueprints or templates for the “stuff” that we’re working with.  Classes are like Objects in Salesforce  They know stuff about themselves (these are their variables)  They can do things (these are their methods) Variables First Name, Last Name, Birthday, Age, Record ID, Favorite Pastime, is Tacky?, Annoyance Rating… Classes – the “Architypes” Methods Eat, Drink, Snorkel, Ride Horses, Sightsee, Take Photos, Complain, Talk Loudly, Tip Poorly, Be Annoying …
  • 13.  Apex objects are like Salesforce records.  Objects are what we create from classes.  If a class is a template for an tourist, then an object is an actual, individual person. Objects – The “Individuals” The Tourista Family! Instances of the Tourist Class (aka Objects) These are objects Photo Credit: http://bit.ly/1JnkRXD Tessa Tourista
  • 14. Force.com/Apex Salesforce Examples Basic Apex Building Blocks Class The Architype Salesforce Contact Object Object The Individual Individual Contact Record *These are loose translations Your Force.com Decoder Ring
  • 15.  Variables are like luggage…they are reusable containers to hold things (data)  They come in different shapes and sizes to store different types of things: small, large, and specialty shapes (e.g., hats, golf clubs)  They have a data type, a name, and a value. Variables – The “Collectors” The type of Luggage (e.g., small case) (data type) mySuitcase (variable name) what mySuitcase contains (value) String mySuitcase = 'Full of Stuff'; data type name value
  • 16. Force.com/Apex Data Types Salesforce Field Type String Text, Text Areas, Auto Number, Url, Phone, Email Integer or Decimal Number, Percent, Currency Boolean Checkbox ID ID of a Salesforce Record Date, DateTime Date, DateTime Your Force.com Field/Data Type Decoder Ring
  • 17. String firstName = 'Tessa'; String lastName = 'Tourista'; Integer numTours = 0; Decimal height = 5.4; Date birthdate = '1983-02-01'; Boolean isTacky = TRUE; String tipLevel = 'Generous'; ID id = '00300000003S5PGBC0'; Tessa Tourista’s Variables typeOfVariable myContainer = contentsOfContainer; data type name value Photo Credit: http://bit.ly/1JnkRXD Tessa Tourista
  • 18.  Methods are the things that objects and classes can do.  They have a name and can be passed arguments (values) that can be used inside the method. Methods – The “Doers” Snorkeling Building sand castles Sunbathing Photo source: http://i.huffpost.com/gen/2062638/images/o-TACKY- TOURIST-facebook.jpg
  • 19. What to wear snorkeling! + OR We have our fins, snorkel, and mask. But how do we decide what else to wear?
  • 20. Using the method Defining what the method does What to wear snorkeling!
  • 21. Shorty wetsuit 66-72◦F What to wear snorkeling! Over 72◦F Bathing suit Full wetsuit Under 66◦F
  • 22. Shorty wetsuit 66-72◦F Full wetsuit Under 66◦F What to wear snorkeling! Over 72◦F Bathing suit What should Tessa wear?
  • 23. Full wetsuit Under 66◦F What to wear snorkeling! Shorty wetsuit 66-72◦F Bathing Suit Time! Not true Not true 75◦F
  • 24. Demo Time: Code in ACTION!! Photo Source: https://www.flickr.com/photos/raneko/5198682308
  • 25. Force.com/Apex Salesforce Examples Basic Apex Building Blocks Class The Architype Salesforce Contact Object Object The Individual Individual Contact Record Variable The Collector Contact Field Method The Do-er Workflow Action* *These are loose translations Your Force.com Decoder Ring
  • 26. DML – The “Courier” SOQL– The “Researcher” Database Manipulation Language DML pushes record changes to Salesforce DML Salesforce Object Query Language SOQL pulls records from Salesforce SOQL
  • 27. DML – The “Courier” DML is used to send data to Salesforce  Insert  Update  Upsert  Delete  Undelete DML DATA PACKAGE DML
  • 28. SOQL – The “Researcher” SOQL is used to pull data from Salesforce It can do a LOT, but at minimum, SOQL has 3 basic pieces:  SELECT – what fields are you want to see  FROM – the Salesforce object that contains these fields  WHERE – any filters on the data SOQL
  • 29. Demo Time: Code in ACTION!!Photo Source: http://hdwallpapersbase.com/wp-content/uploads/2013/01/Husky-Puppy-Wallpaper1.jpg
  • 30. Force.com/Apex Salesforce Examples Basic Apex Building Blocks Class The Architype Salesforce Contact Object Object The Individual Individual Contact Record Variable The Collector Contact Field Method The Do-er Workflow Action* Get Data In & Out of Salesforce DML The Courier Save Button* SOQL Query The Researcher Tabular Report* *These are loose translations Your Force.com Decoder Ring
  • 31. Photo credit: Melvin Gaal (Mindsharing.eu) / Foter.com  Triggers kick off code-based automated processes.  They listen for certain database events (e.g., a record being inserted, updated, etc.).  They either link to or contain the code that makes the magic happen. This lets us do things like…  Compare data before & after a change is made.  Create new, and update existing, related records.  Interact with external data and web services (e.g., external databases & SMS text message services) Triggers– the “Listeners”
  • 32. Trigger Example (avoid double booking)  We have tours and we have tourists.  Tourists can only be on one tour at a time.  Need something to double-check that we're not double booking tourists. Step 1: Try to add a tourist Contact to a tour. Step 2: Find out what other tours this contact is already booked on. Step 3: Compare the start date of the tours that the person is already on with the start date of the tour we want to add them to. Step 4: If the tour you want to add them to conflicts with the dates of their existing tours, then give an error message and don't let us book the tour. ????
  • 33. What does this look like in code? ??? //1. When we try and add or update a tourparticipants__c record, then before you commit the data to the database run this trigger. trigger RejectTourDoubleBooking on TourParticipants__c (before insert, before update) { //2. Create a list of all the records (called TPs for "Tour Participants") that we sent to the trigger. Then loop over all these records, and for each one run some code. for (TourParticipants__c TPs : trigger.new) { //3. For each item in the TP list, create another list (called tour) that gets the ID and the start date of the tour we are wanting to add the contact to. Tour__c tour = [SELECT id, startDate__c FROM Tour__c WHERE id = :TPs.tour__c]; //4. Create another list of TourParticipant__c records (called conflicts). Put in this list any records from the TourParticipants__c custom object where the same person we're wanting to add to a tour is already on a tour with the same start date as the tour we are wanting to add them to. list <TourParticipants__c> conflicts = [SELECT id FROM TourParticipants__c WHERE contact__c = :TPs.contact__c AND tour__r.startDate__c = :tour.startDate__c]; //5. If the "conflicts" list is NOT (!) empty, then block the contact from being added to the tour. if (! conflicts.isEmpty() ) { TPs.addError('***DOUBLE BOOKING ERROR***'); } } } WARNING: WE KNOW THIS CODE IS FLAWED
  • 34. What does this look like in code? ??? trigger RejectTourDoubleBooking on TourParticipants__c (before insert, before update) { for (TourParticipants__c TPs : trigger.new) { Tour__c tour = [SELECT id, startDate__c FROM Tour__c WHERE id = :TPs.tour__c]; list <TourParticipants__c> conflicts = [SELECT id FROM TourParticipants__c WHERE contact__c = :TPs.contact__c AND tour__r.startDate__c = :tour.startDate__c]; if (! conflicts.isEmpty() ) { TPs.addError('***DOUBLE BOOKING ERROR***'); } } } WARNING: WE KNOW THIS CODE IS FLAWED
  • 35. Demo Time: Code in ACTION!!Photo Source: https://upload.wikimedia.org/wikipedia/commons/f/ff/Cat_on_laptop_-_Just_Browsing.jpg
  • 36. Force.com/Apex Salesforce Examples Basic Apex Building Blocks Class The Architype Salesforce Account Object Object The Individual Individual Account Record Variable The Collector Account Field Method The Do-er Workflow Action* Get Data In & Out of Salesforce DML The Courier Save Button* SOQL Query The Researcher Tabular Report* Putting it All Together Triggers The Listener Workflow Rule Criteria* *These are loose translations Your Force.com Decoder Ring
  • 37. More Admins who Code at Dreamforce Sessions for Beginning Coders  Intro to Apex for Admins  Intro to Apex Triggers*  From "Awesome Admin" to "Champion Coder" (How to become a force.com developer)  Triggers for Admins: A Five-step Framework for Creating Triggers  Workflow Formulas as a Gateway to Coding The Dev Zone & Developer Library (Moscone West) Hands-on Trainings  Getting Started with Apex Code for Admins  Getting Started with Visualforce for Admins * Already happened but may have been recorded
  • 38. Want to know more? Salesforce Trailhead Free online training and tutorials (clicks & code) bit.ly/sfdc-trailhead Force.com Video Training Udacity, Pluralsight bit.ly/apex-video-training RAD Women Learn to code on force.com with other women bit.ly/rad-women Women Code Heroes Helping awesome admins learn to code. Decoder ring included WomenCodeHeroes.com sfdc99.com Apex coding for the 99% sfdc99.com Salesforce Dev Community Tip sheets, workbooks, cookbooks, documentation… developer.salesforce.com
  • 39. Keep the learning going in the Admin Lodge Admin Theater 55+ Sessions by Admins for Admins! Visit Customer-Led Demos Learn more with Trailhead! Earn your Apex Basics & Database badge
  • 40. Share Your Feedback and Win a GoPro Enroll in a session1 Tap the bell to take a survey 2 3 Earn a GoPro prize entry for each completed survey

Notas do Editor

  1. LEEANNE
  2. ANGELA Please make purchasing purchase decisions based upon features that are currently available.
  3. Kieren then angela (I'd rather introduce myself( So now that you know about us, what about you? KIEREN Shout out AWESOME ADMIN if you are a salesforce admin Shout out ADMIN WHO CODES if you are an admin who does even a little bit of code ANGELA Shout out CODER if you are a salesforce developer If you're none of these, then shout out "I DON'T KNOW WHAT I'M HERE FOR BUT I HEARD THEY WERE GIVING AWAY A FREE TRIP TO HAWAII" So wrong! *** (angela) so what do we have in store for you today…
  4. KIEREN Both Angela and I love traveling, so the first thing you'll see is a lot of travel related stuff. We have built this session around the Forcelandia Terriffic Tour Company. So with that in mind what will you see on todays day trip? We’ll look at why you might want to learn code When you should click and when you should code We'll go over the seven basic building blocks of force.com coding including see those blocks in action OUT CUE>>>Lastly we'll give you further resources to learn to code
  5. ANGELA *** not a lot of information about there…hence this session. OUT CUE >>> So let's start with the most basic question…
  6. KIEREN …and that is… when click and when code. First off, if you can click, you probably should. There are a ton of declarative options for Salesforce development from formula fields and workflow rules to the new lightning process builder. There are, however some times when it's helpful to code. For example, if you are running very complex code that is updating or creating records and you want to control the order that your automation is run in. then it's proably a good time to code. There are also times when you don't want to deal with security roles and sharing rules, these are also great times to code. We'll see that code can also summarize data in ways that clicks can't. *** So time for our clicks vs code pop quiz . We have two scenarios, and we'll ask you to choose whether you should click or code.
  7. ANGELA SHOUT OUT – who thinks you would click? Who think you would code? OUT CUE >>>
  8. ANGELA OUT CUE >>> You could easily do this with a workflow rule
  9. KIEREN Scenario #2 – If you wanted to do the same task, but assign it to the top sales person from the previous fiscal quarter…will you click or code? SHOUT OUT – hoot and holler for clicks? Hoot and holler for code?
  10. KIEREN That's right…you would need to use code, because that's the only way you can automate assigning it to the top sales person. Great! It looks like you all have a basic understanding of when to click and when to code, so it's OUT CUE >>> time to embark on our force.com tour . So let's put on our sun hats and leis and start the tour!
  11. KIEREN As we prepare our journey, it’s a good idea to understand our itinerary. Any time you are visiting another country, there is the possibility you need to learn some key phrases in another language. You can think of Force.com coding as another language; and we'll show you seven of them today. We will relate them all to something that will hopefully make them easier to understand and remember. There are for basic building blocks : classes, objects, methods, and variables There are two ways to transport data: DML and SOQL <<OUT CUE>>>And pulling it all together, we have triggers. Let's check out each of these in turn.
  12. KIEREN We'll first start with is the place were most of the work happens in apex. The apex class. We call this the Architype, because Classes act like a blueprint or template for the stuff that we will be creating. If I were to equate this to what you know about Salesforce as admins, it would be close to say that Apex Classes are like Salesforce Objects. We will go into this in more depth, but classes know things about themselves (they have variables) and can do things (they have methods). Let me demonstrate what I mean. I'd like you to close your eyes for me…yep…that means you! Picture in your mind a typical tourist. Think about what they are wearing, and what kind of person they are. What is their age, what are the favorite activities, are they annoying and loud? Are they a tacky tourist? These are the variables or what the class knows about itself Now picture what your typical or archetypal tourist can do…can it eat and drink, can it sightsee, or go snorkeling… these are our tourist class methods, or things that our tourist class can do. Great…open your eyes again but keep that archetypal tourist class in your mind <OUT CUE>>> so now we have what the classes are all about…let's look how this relates to Apex objects.
  13. ANGELA – they are our actual tourists. <OUT CUE>>> let's whip out our decoder ring.
  14. KIEREN So we have now described both classes our architypes and objects our individuals, <OUT CUE>>> so let's move on to our next building block
  15. KIEREN – We call Variables the Collectors, because they're kind of like luggage, they are containers that collect and hold things, like data. And just like luggage, there are different types of variables that hold different types of data. With luggage, you may have large bags and small bags, and toiletry bags, and hat bags and even bags to hold your golf clubs! In Apex, you have variables that can store, for example, text values, numbers, and dates. You can think of variables as similar to fields in salesforce. And like fields, they have a name, a type and a value. Just like there are fields in salesforce to hold text, in Apex we call these String variables. So looking at the example on the screen, we have a string variable, that is called mySuitcase, and it has a value of “Full of Stuff” <<OUT CUE>>> let's open our phrase book again and see how we can translate Force.com variables into Salesforce fields.
  16. KIEREN This is where we're doing the same thing, but using different words. *** so lets look at some specific variables related to one our Tourist objects…tessa tourista.
  17. ANGELA – <OUT CUE >>> now we can describe her…let's look at what she can do.
  18. ANGELA Methods, as I’ve said are the bits of objects are the Doers of the coding world. They like to take action. They also have a name and you can pass them data. An example of a method in Salesforce, might be the search. It does something...it take the data that you pass it, and searches all your salesforce records for it. The bit of data that you send it is called an argument (fancy name for a value). And the method uses it and then, in many cases sends something back. In our search example, it sends back search results. Thinking back to our tourist example, the various methods that tourists might do would be to sun bathe, to build sand castles and to snorkel. Kieren – shopping or drink mai tai … *** no….
  19. ANGLEA – coding is fun, it's problem solvers. we're just showing you different ways to solve problems. As we dive into the code. But there is the perennial problem of what to wear? If I'm the object Tessa, I know that I have fins and snorkel and mask, but I need to know whether I'll be ok in my bathing suit, or if I should put in my super shorty? <OUT CUE >>> So let's see some code that will help us decide!
  20. KIEREN What you're looking at now is real live code! We will be going through this in detail, so keep calm, but in broad strokes, the first part (in blue) is where we are using (or calling) the snorkel method The second part (in gold) is the actual method with everything it is programmed to do. *** <<OUT CUE>> let's step though this bit by bit
  21. KIEREN You can see that in the top part, we call the snorkel method and we pass it the water temperature (75 degrees Farenheit). Look at the matching pieces below. Ignore the public void bit, but you can see that we are naming the method and then setting up an integer (or number) variable called waterTemp. <<OUT CUE>>> Next let's look at the functioning of this method
  22. KIEREN Who here has created a formula field in Salesforce? And who has use a conditional IF statement? Well this next piece of code is like that. We are saying, if the water temp is under 65 – bloody cold, then Tessa would need to put on a full wetsuit. If that test fails (the temperature is 65 or more degrees) , then we go on to the next one, if the temperature is less than 73 degrees, then Tessa should put on a shorty wetsuit. If that test fails (because the temp is 73 or more degrees), then Tessa just needs a bathing suit . So another pop quiz…Look at the temperature that we're passing in to the snorkel variable (it's boxed in red). From this… who thinks that Tessa should put on a full wet suite? Ok…and who thinks she should put on a shorty wetsuit And lastly, who think's she fine in her super sporty swim suit? <<<OUT CUE>>> Let's find out who's right!
  23. KIEREN Congrats to most of you who picked right…if the water temperature of 75 degrees, then the first two tests fail, which leaves Tessa wearing a bathing suit!
  24. KIEREN But let's see this code in action. //Call the snorkel method and //pass it the water temperature snorkel(75); //Code for the snorkel method, //which takes an integer variable Public void snorkel(Integer waterTemp){ //Put on different snorkeling equipment //based on water temperature IF (waterTemp < 65) { System.debug('=== It is bloody cold!'); System.debug('=== Tourists should put on a full wetsuit'); //code for putting on full wetsuit } ELSE IF (waterTemp < 73){ System.debug('=== It is a bit chilled out there.'); System.debug('=== Tourists should wear their shorty wetsuit!'); //code for putting on shorty wetsuit } ELSE { System.debug('=== Woo hooo! It water is so lovely!'); System.debug('=== Tourists should only wear swim suits!'); //code for putting on bathing suit } //end if } //end snorkel method
  25. ANGELA Let's recap what we know. We have gone through all four basic building blocks of apex – Classes, objects, variables and methods. <OUT CUE>>> next let's look at how we get data in and out of salesforce.
  26. ANGLEA So enough about Objects and classes and such. Let's talk about two other great Force.com Coding concepts for working with data. DML and SOQL These are the coding tools we use to get data in and out of salesforce. I call DML the courier because we package up data and it delivers it to our Salesforce database SOQL is the researcher, because with it we write queries that pull data back from the salesforce database. <<<OUT CUE>>> let's look at them individually.
  27. ANGELA There are various actions you can take in a DML statement… Creating a contact object and setting all the variables and values <OUT CUE>>> Then the bit at the bottom is the actual DML. It's small but it's mighty!
  28. KIEREN We call SOQL the researcher, because we ask it questions and it sends us back results. There are three basic pieces to a SOQL query, SELECT, FROM and WHERE. Let's look at the example to the right. If I were to say this in plain English, it would say Go find me the name, id and tiplevel fields from the contact salesforce object where the tiplevel is generous. <OUT CUE>>> Now we know who to give extra attention to in our tour
  29. KIEREN – Run query Add tessa Run query again
  30. KIEREN To recap, we have the four basic building blocks of apex, classes, objects, variables and methods, and we have introduced the two ways to transport data to and from salesforce. <<<OUT CUE>>> so what's left?
  31. KIEREN The last concept we'll talk about today is the Trigger. We call the trigger the listener, because that is what it does…it's whole job is listening for things to happen in the database and then triggering code to happen. The stuff that they're listening for are any time a record is added, updated, deleted, or undeleted from the Salesforce database. They are cool because they can also compare data before and after a change happens, which is great for data validation. They can also create new records and update existing ones. They can also interact with things outside of salesforce, like text message services. *** let's look at a real life example.
  32. ANGLEA *** lets put together some comments
  33. ANGELA – First let's look at how we would talk about writing this in code. Everything in brown is a comment – this is code that just says what we are wanting to do. It helps us understand what we're looking at (especially later when we forget!). Note that this is for demonstration purposes…there are problems with this code and it breaks quite a few best practices, but it's short and that's good enough for today! *** now let's pull out our phrase book and translate this into force.com Apex code.
  34. ANGELA – now we add the actual code. Everything in blue is a variable name Everything in teal is SOQL Everything in purple are special keywords that do stuff (like create the trigger, or loop over a list of records, or perform and if statement).
  35. ANGELA – show code in dev console. Go into tours > Kenyan tour Add tessa – no problem Add tony – problem Make joke.
  36. KIEREN Wow…sad to say, but we're almost at the end of our fabulous Force.com Coding Tour. If you liked the show, then please feel free to tip your tour guides. We particularly like fruity coctails with umbrellas. If you liked this tour, and you're ready for the next step, we have some side trips you may be interested in. ***so here are some great resources to keep the coding bus rolling
  37. ANGELA *** and for when you get home…
  38. KIEREN (left ) ANGELA (right) Trailhead is an amazing and amazingly free resource with all sorts of online learing related to both the clicks and code sides of Salesforce. You can also access some free Force.com Video training at the url provided there. If you're an advanced admin and would like to take a step to the coding side, then check out Rad women ANGLEA Here are some amazing free resources to keep you coding. <<<OUT CUE>>> salesforce Dev community.
  39. As part of the Admin Track at Dreamforce we want the learning to continue about this subject past this presentation. You can visit the Admin Zone to see customer led demoes and specifically look for the Coding for Admins station. And go to Trailhead to learn more and earn your Apex Basics and Database badges.
  40. ANGELA