SlideShare a Scribd company logo
#forcewebinar
Coding Apps in the Cloud with Force.com – Part II
March 31st , 2016
#forcewebinar#forcewebinar
Speakers
Shashank Srivatsavaya
Sr. Developer Advocate Engineer
@shashforce
Sonam Raju
Sr. Developer Advocate Engineer
@sonamraju14
Forward Looking Statement
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.
Statement under the Private Securities Litigation Reform Act of 1995:
#forcewebinar
Go Social!
@salesforcedevs / #forcewebinar
Salesforce Developers
Salesforce Developers
Salesforce Developers
This webinar is being recorded!
The video will be posted to
YouTube & the webinar recap
page (same URL as
registration).
#forcewebinar
Agenda
• Part I – Demo
• Visualforce Pages
• Controllers
• Javascript in Visualforce Pages
• Part II - Demo
• Q&A
#forcewebinar
Part I : Demo
(Data Model, Application, Apex, SOQL, Triggers)
#forcewebinar
Visualforce
#forcewebinar
What's a Visualforce Page?
▪ HTML page with tags executed at the server-side to
generate dynamic content
▪ Similar to JSP and ASP
▪ Can leverage JavaScript and CSS libraries
▪ The View in MVC architecture
#forcewebinar
Model-View-Controller
Model
Data + Rules
Controller
View-Model
interactions
View
UI code
▪ Separation of concerns
– No data access code in view
– No view code in controller
▪ Benefits
– Minimize impact of changes
– More reusable components
#forcewebinar
Model-View-Controller in Salesforce
View
• Standard Pages
• Visualforce Pages
• External apps
Controller
• Standard Controllers
• Controller Extensions
• Custom Controllers
Model
• Objects
• Triggers (Apex)
• Classes (Apex)
#forcewebinar
Component Library
▪ Presentation tags
– <apex:pageBlock title="My Account Contacts">
▪ Fine grained data tags
– <apex:outputField value="{!contact.firstname}">
– <apex:inputField value="{!contact.firstname}">
▪ Coarse grained data tags
– <apex:detail>
– <apex:pageBlockTable>
▪ Action tags
– <apex:commandButton action="{!save}" >
#forcewebinar
Expression Language
▪ Anything inside of {! } is evaluated as an expression
▪ Same expression language as Formulas
▪ $ provides access to global variables (User,
RemoteAction, Resource, …)
– {! $User.FirstName } {! $User.LastName }
#forcewebinar
Example 1
• <apex:page>
• <h1>Hello, {!$User.FirstName}</h1>
• </apex:page>
#forcewebinar
Controllers
#forcewebinar
Standard Controller
▪ A standard controller is available for all objects
– You don't have to write it!
▪ Provides standard CRUD operations
– Create, Update, Delete, Field Access, etc.
▪ Can be extended with more capabilities
▪ Uses id query string parameter in URL to access object
#forcewebinar
Example 2
• <apex:page standardController="Contact">
• <apex:form>
• <apex:inputField value="{!contact.firstname}"/>
• <apex:inputField value="{!contact.lastname}"/>
• <apex:commandButton action="{!save}" value="Save"/>
• </apex:form>
• </apex:page>
Function in
standard controller
Standard controller
object
#forcewebinar
Email
Templates
Embedded in Page
Layouts
Generate PDFs
Custom Tabs
Mobile Interfaces
Page Overrides
Where can I use Visualforce?
#forcewebinar
What's a Custom Controller?
• Custom class written in Apex
• Doesn't work on a specific object
• Provides custom data
• Provides custom behaviors
#forcewebinar
Defining a Custom Controller
<apex:page controller="FlickrController">
#forcewebinar
Custom Controller Example
public with sharing class FlickrController {
public FlickrList getPictures() {
HttpRequest req = new HttpRequest();
req.setMethod('GET');
req.setEndpoint('http://api.flickr.com/services/feeds/');
HTTP http = new HTTP();
HTTPResponse res = http.send(req);
return (FlickrList) JSON.deserialize(res.getBody(),
FlickrList.class);
}
}
#forcewebinar
What's a Controller Extension?
• Custom class written in Apex
• Works on the same object as the standard controller
• Can override standard controller behavior
• Can add new capabilities
#forcewebinar
Defining a Controller Extension
<apex:page standardController="Speaker__c"
extensions="SpeakerCtrlExt">
Provides basic
CRUD
Overrides standard
actions and/or provide
additional capabilities
#forcewebinar
Defining a Controller Extension
<apex:page standardController="Speaker__c"
extensions="CtrlExt1,CtrlExt2,CtrlExt3">
Provides basic
CRUD
Can contain multiple
extensions
#forcewebinar
Anatomy of a Controller Extension
public class SpeakerCtrlExt {
private final Speaker__c speaker;
private ApexPages.StandardController stdController;
public SpeakerCtrlExt (ApexPages.StandardController ctrl) {
this.stdController = ctrl;
this.speaker = (Speaker__c)ctrl.getRecord();
}
// method overrides
// custom methods
}
#forcewebinar
Javascript in Visualforce Pages
#forcewebinar
Why Use JavaScript?
• Build Engaging User Experiences
• Leverage JavaScript Libraries
• Build Custom Applications
#forcewebinar
JavaScript in Visualforce Pages
Visualforce Page
JavaScript Remoting
Remote Objects
(REST)
#forcewebinar
Examples
#forcewebinar
JavaScript Remoting - Server-Side
global with sharing class HotelRemoter {
@RemoteAction
global static List<Hotel__c> findAll() {
return [SELECT Id,
Name,
Location__Latitude__s,
Location__Longitude__s
FROM Hotel__c];
}
}
#forcewebinar
"global with sharing"?
• global
• Available from outside of the application
• with sharing
• Run code with current user permissions. (Apex code runs in system
context by default -- with access to all objects and fields)
#forcewebinar
JavaScript Remoting - Visualforce
Page
<script>
Visualforce.remoting.Manager.invokeAction(
'{!$RemoteAction.HotelRemoter.findAll}',
function (result, event) {
if (event.status) {
for (var i = 0; i < result.length; i++) {
var lat = result[i].Location__Latitude__s;
var lng = result[i].Location__Longitude__s;
addMarker(lat, lng);
}
} else {
alert(event.message);
}
}
);
</script>
#forcewebinar
Using JavaScript and CSS Libraries
• Hosted elsewhere
<script src="https://maps.googleapis.com/maps/api/js"></script>
• Hosted in Salesforce
• Upload individual file or Zip file as Static Resource
• Reference asset using special tags
#forcewebinar
Static Resources
#forcewebinar
Referencing Static Resources
// Single file
<apex:stylesheet value="{!$Resource.bootstrap}"/>
<apex:includeScript value="{!$Resource.jquery}"/>
<apex:image url="{!$Resource.logo}"/>
// ZIP file
<apex:stylesheet value="{!URLFOR($Resource.assets, 'css/main.css')}"/>
<apex:image url="{!URLFOR($Resource.assets, 'img/logo.png')}"/>
<apex:includeScript value="{!URLFOR($Resource.assets, 'js/app.js')}"/>
#forcewebinar
Referencing Static Resources
// Single file
<link href="{!$Resource.bootstrap}" rel="stylesheet"/>
<img src="{!$Resource.logo}"/>
<script src="{!$Resource.jquery}"></script>
// ZIP file
<link href="{!URLFOR($Resource.assets, 'css/main.css')}" rel="stylesheet"/>
<img src="{!URLFOR($Resource.assets, 'img/logo.png')}"/>
<script src="{!URLFOR($Resource.assets, 'js/app.js')}"></script>
#forcewebinar
Demo
(Visualforce with Standard controller and Extension,
Custom Controller and Javascript)
developer.salesforce.com/trailhead
#forcewebinar#forcewebinar
Recommended Trail:
#forcewebinar#forcewebinar
Got Questions?
Post’em to
http://developer.salesforce.com/forums/
#forcewebinar#forcewebinar
Q&A
Your feedback is crucial to the success
of our webinar programs. Thank you!
http://bit.ly/forcewebinarfeedback
#forcewebinar#forcewebinar
Thank You
Try Trailhead: trailhead.salesforce.com
Join the conversation: #forcewebinar
@salesforcedevs @SonamRaju14 @shashforce

More Related Content

What's hot (20)

PPTX
Secure Development on the Salesforce Platform - Part 2
Salesforce Developers
 
PDF
Lightning web components episode 2- work with salesforce data
Salesforce Developers
 
PPTX
TrailheaDX and Summer '19: Developer Highlights
Salesforce Developers
 
PPTX
Introduction to Apex for Developers
Salesforce Developers
 
PDF
Tech Enablement Webinar for ISVs (March 16, 2017)
Salesforce Partners
 
PDF
Manage Massive Datasets with Big Objects & Async SOQL
Salesforce Developers
 
PPTX
Integrating with salesforce
Mark Adcock
 
PPTX
Migrating Visualforce Pages to Lightning
Salesforce Developers
 
PPTX
Coding in the App Cloud
Salesforce Developers
 
PPTX
Secure Development on the Salesforce Platform - Part 3
Mark Adcock
 
PDF
ISV Tech Enablement Webinar April 2017
Salesforce Partners
 
PPTX
TrailheaDX India : Developer Highlights
Salesforce Developers
 
PPTX
#Df17 Recap Series Build Apps Faster with the Salesforce Platform
Salesforce Developers
 
PPTX
Building a Single Page App with Lightning Components
Salesforce Developers
 
PDF
SLDS and Lightning Components
Salesforce Developers
 
PPTX
Mds cloud saturday 2015 salesforce intro
David Scruggs
 
PPTX
Build and Package Lightning Components for Lightning Exchange
Salesforce Developers
 
PDF
Replicate Salesforce Data in Real Time with Change Data Capture
Salesforce Developers
 
PPTX
Modeling and Querying Data and Relationships in Salesforce
Salesforce Developers
 
PPTX
Exploring the Salesforce REST API
Salesforce Developers
 
Secure Development on the Salesforce Platform - Part 2
Salesforce Developers
 
Lightning web components episode 2- work with salesforce data
Salesforce Developers
 
TrailheaDX and Summer '19: Developer Highlights
Salesforce Developers
 
Introduction to Apex for Developers
Salesforce Developers
 
Tech Enablement Webinar for ISVs (March 16, 2017)
Salesforce Partners
 
Manage Massive Datasets with Big Objects & Async SOQL
Salesforce Developers
 
Integrating with salesforce
Mark Adcock
 
Migrating Visualforce Pages to Lightning
Salesforce Developers
 
Coding in the App Cloud
Salesforce Developers
 
Secure Development on the Salesforce Platform - Part 3
Mark Adcock
 
ISV Tech Enablement Webinar April 2017
Salesforce Partners
 
TrailheaDX India : Developer Highlights
Salesforce Developers
 
#Df17 Recap Series Build Apps Faster with the Salesforce Platform
Salesforce Developers
 
Building a Single Page App with Lightning Components
Salesforce Developers
 
SLDS and Lightning Components
Salesforce Developers
 
Mds cloud saturday 2015 salesforce intro
David Scruggs
 
Build and Package Lightning Components for Lightning Exchange
Salesforce Developers
 
Replicate Salesforce Data in Real Time with Change Data Capture
Salesforce Developers
 
Modeling and Querying Data and Relationships in Salesforce
Salesforce Developers
 
Exploring the Salesforce REST API
Salesforce Developers
 

Viewers also liked (19)

PDF
Advanced Apex Development - Asynchronous Processes
Salesforce Developers
 
PPTX
Coding Apps in the Cloud with Force.com - Part I
Salesforce Developers
 
PPTX
Diving Into Heroku Private Spaces
Salesforce Developers
 
PPTX
Lighting up the Bay, Real-World App Cloud
Salesforce Developers
 
PPTX
Lightning Developer Experience, Eclipse IDE Evolved
Salesforce Developers
 
PPTX
Integrating Salesforce with Microsoft Office through Add-ins
Salesforce Developers
 
PPTX
Process Automation on Lightning Platform Workshop
Salesforce Developers
 
PDF
Spring '16 Release Preview Webinar
Salesforce Developers
 
PPTX
Webinar: Integrating Salesforce and Slack (05 12-16)
Salesforce Developers
 
PPTX
Mastering the Lightning Framework - Part 2
Salesforce Developers
 
PPTX
Mastering the Lightning Framework - Part 1
Salesforce Developers
 
PPTX
Secure Development on the Salesforce Platform - Part I
Salesforce Developers
 
PPT
Advanced Platform Series - OAuth and Social Authentication
Salesforce Developers
 
PDF
Javascript Security and Lightning Locker Service
Salesforce Developers
 
PPTX
Unleash the Power of Apex Realtime Debugger
Salesforce Developers
 
PPTX
Reinvent your App Dev Lifecycle with Continuous Delivery on Heroku
Salesforce Developers
 
PPTX
Snap-in Service to Web and Mobile Apps
Salesforce Developers
 
PDF
Introduction to the Salesforce Security Model
Salesforce Developers
 
PPTX
Lightning Experience with Visualforce Best Practices
Salesforce Developers
 
Advanced Apex Development - Asynchronous Processes
Salesforce Developers
 
Coding Apps in the Cloud with Force.com - Part I
Salesforce Developers
 
Diving Into Heroku Private Spaces
Salesforce Developers
 
Lighting up the Bay, Real-World App Cloud
Salesforce Developers
 
Lightning Developer Experience, Eclipse IDE Evolved
Salesforce Developers
 
Integrating Salesforce with Microsoft Office through Add-ins
Salesforce Developers
 
Process Automation on Lightning Platform Workshop
Salesforce Developers
 
Spring '16 Release Preview Webinar
Salesforce Developers
 
Webinar: Integrating Salesforce and Slack (05 12-16)
Salesforce Developers
 
Mastering the Lightning Framework - Part 2
Salesforce Developers
 
Mastering the Lightning Framework - Part 1
Salesforce Developers
 
Secure Development on the Salesforce Platform - Part I
Salesforce Developers
 
Advanced Platform Series - OAuth and Social Authentication
Salesforce Developers
 
Javascript Security and Lightning Locker Service
Salesforce Developers
 
Unleash the Power of Apex Realtime Debugger
Salesforce Developers
 
Reinvent your App Dev Lifecycle with Continuous Delivery on Heroku
Salesforce Developers
 
Snap-in Service to Web and Mobile Apps
Salesforce Developers
 
Introduction to the Salesforce Security Model
Salesforce Developers
 
Lightning Experience with Visualforce Best Practices
Salesforce Developers
 
Ad

Similar to Coding Apps in the Cloud with Force.com - Part 2 (20)

PDF
Force.com Friday: Intro to Force.com
Salesforce Developers
 
PPTX
Force.com Friday: Intro to Visualforce (May 8, 2015)
Salesforce Developers
 
PPTX
Force.com Friday - Intro to Visualforce
Shivanath Devinarayanan
 
PPTX
Force.com Friday : Intro to Visualforce
Salesforce Developers
 
PPTX
Introducing Visualforce
Mohammed Safwat Abu Kwaik
 
PDF
Visualforce in Salesforce1: Optimizing your User Interface for Mobile
Salesforce Developers
 
PPTX
Mastering Force.com: Advanced Visualforce
Salesforce Developers
 
PPTX
Elevate Tel Aviv
sready
 
POTX
Hands-on Workshop: Intermediate Development with Heroku and Force.com
Salesforce Developers
 
PDF
Intro to Apex Programmers
Salesforce Developers
 
PPTX
Summer '14 Release Developer Preview
Salesforce Developers
 
PDF
Spring '14 Release Developer Preview Webinar
Salesforce Developers
 
PDF
Winter 14 Release Developer Preview
Salesforce Developers
 
PDF
Introduction to Visualforce
Salesforce Developers
 
PPTX
Visualforce
Milind Gokhale
 
PPTX
Intro to Apex - Salesforce Force Friday Webinar
Abhinav Gupta
 
PDF
Introduction to Visualforce
Salesforce Developers
 
PPTX
JavaScript Integration with Visualforce
Salesforce Developers
 
PDF
Introduction to Visualforce Webinar
Salesforce Developers
 
PDF
Elevate london dec 2014.pptx
Peter Chittum
 
Force.com Friday: Intro to Force.com
Salesforce Developers
 
Force.com Friday: Intro to Visualforce (May 8, 2015)
Salesforce Developers
 
Force.com Friday - Intro to Visualforce
Shivanath Devinarayanan
 
Force.com Friday : Intro to Visualforce
Salesforce Developers
 
Introducing Visualforce
Mohammed Safwat Abu Kwaik
 
Visualforce in Salesforce1: Optimizing your User Interface for Mobile
Salesforce Developers
 
Mastering Force.com: Advanced Visualforce
Salesforce Developers
 
Elevate Tel Aviv
sready
 
Hands-on Workshop: Intermediate Development with Heroku and Force.com
Salesforce Developers
 
Intro to Apex Programmers
Salesforce Developers
 
Summer '14 Release Developer Preview
Salesforce Developers
 
Spring '14 Release Developer Preview Webinar
Salesforce Developers
 
Winter 14 Release Developer Preview
Salesforce Developers
 
Introduction to Visualforce
Salesforce Developers
 
Visualforce
Milind Gokhale
 
Intro to Apex - Salesforce Force Friday Webinar
Abhinav Gupta
 
Introduction to Visualforce
Salesforce Developers
 
JavaScript Integration with Visualforce
Salesforce Developers
 
Introduction to Visualforce Webinar
Salesforce Developers
 
Elevate london dec 2014.pptx
Peter Chittum
 
Ad

More from Salesforce Developers (20)

PDF
Sample Gallery: Reference Code and Best Practices for Salesforce Developers
Salesforce Developers
 
PDF
Maximizing Salesforce Lightning Experience and Lightning Component Performance
Salesforce Developers
 
PDF
Local development with Open Source Base Components
Salesforce Developers
 
PDF
Why developers shouldn’t miss TrailheaDX India
Salesforce Developers
 
PPTX
CodeLive: Build Lightning Web Components faster with Local Development
Salesforce Developers
 
PPTX
CodeLive: Converting Aura Components to Lightning Web Components
Salesforce Developers
 
PPTX
Enterprise-grade UI with open source Lightning Web Components
Salesforce Developers
 
PDF
Live coding with LWC
Salesforce Developers
 
PDF
Lightning web components - Episode 4 : Security and Testing
Salesforce Developers
 
PDF
Lightning web components - Episode 1 - An Introduction
Salesforce Developers
 
PDF
Migrating CPQ to Advanced Calculator and JSQCP
Salesforce Developers
 
PDF
Scale with Large Data Volumes and Big Objects in Salesforce
Salesforce Developers
 
PDF
Modern Development with Salesforce DX
Salesforce Developers
 
PDF
Get Into Lightning Flow Development
Salesforce Developers
 
PDF
Integrate CMS Content Into Lightning Communities with CMS Connect
Salesforce Developers
 
PDF
Introduction to MuleSoft
Salesforce Developers
 
PDF
Modern App Dev: Modular Development Strategies
Salesforce Developers
 
PPTX
Dreamforce Developer Recap
Salesforce Developers
 
PDF
Vs Code for Salesforce Developers
Salesforce Developers
 
PDF
Vs Code for Salesforce Developers
Salesforce Developers
 
Sample Gallery: Reference Code and Best Practices for Salesforce Developers
Salesforce Developers
 
Maximizing Salesforce Lightning Experience and Lightning Component Performance
Salesforce Developers
 
Local development with Open Source Base Components
Salesforce Developers
 
Why developers shouldn’t miss TrailheaDX India
Salesforce Developers
 
CodeLive: Build Lightning Web Components faster with Local Development
Salesforce Developers
 
CodeLive: Converting Aura Components to Lightning Web Components
Salesforce Developers
 
Enterprise-grade UI with open source Lightning Web Components
Salesforce Developers
 
Live coding with LWC
Salesforce Developers
 
Lightning web components - Episode 4 : Security and Testing
Salesforce Developers
 
Lightning web components - Episode 1 - An Introduction
Salesforce Developers
 
Migrating CPQ to Advanced Calculator and JSQCP
Salesforce Developers
 
Scale with Large Data Volumes and Big Objects in Salesforce
Salesforce Developers
 
Modern Development with Salesforce DX
Salesforce Developers
 
Get Into Lightning Flow Development
Salesforce Developers
 
Integrate CMS Content Into Lightning Communities with CMS Connect
Salesforce Developers
 
Introduction to MuleSoft
Salesforce Developers
 
Modern App Dev: Modular Development Strategies
Salesforce Developers
 
Dreamforce Developer Recap
Salesforce Developers
 
Vs Code for Salesforce Developers
Salesforce Developers
 
Vs Code for Salesforce Developers
Salesforce Developers
 

Recently uploaded (20)

PDF
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
PPTX
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
PPTX
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
PDF
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 
PPTX
Practical Applications of AI in Local Government
OnBoard
 
PDF
Database Benchmarking for Performance Masterclass: Session 1 - Benchmarking F...
ScyllaDB
 
PDF
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
PDF
LLM Search Readiness Audit - Dentsu x SEO Square - June 2025.pdf
Nick Samuel
 
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
PPTX
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
PDF
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
PDF
Database Benchmarking for Performance Masterclass: Session 2 - Data Modeling ...
ScyllaDB
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 
PDF
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
 
PPTX
𝙳𝚘𝚠𝚗𝚕𝚘𝚊𝚍—Wondershare Filmora Crack 14.0.7 + Key Download 2025
sebastian aliya
 
PDF
Open Source Milvus Vector Database v 2.6
Zilliz
 
PDF
ArcGIS Utility Network Migration - The Hunter Water Story
Safe Software
 
PDF
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
PPTX
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 
Practical Applications of AI in Local Government
OnBoard
 
Database Benchmarking for Performance Masterclass: Session 1 - Benchmarking F...
ScyllaDB
 
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
LLM Search Readiness Audit - Dentsu x SEO Square - June 2025.pdf
Nick Samuel
 
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
Database Benchmarking for Performance Masterclass: Session 2 - Data Modeling ...
ScyllaDB
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
 
𝙳𝚘𝚠𝚗𝚕𝚘𝚊𝚍—Wondershare Filmora Crack 14.0.7 + Key Download 2025
sebastian aliya
 
Open Source Milvus Vector Database v 2.6
Zilliz
 
ArcGIS Utility Network Migration - The Hunter Water Story
Safe Software
 
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 

Coding Apps in the Cloud with Force.com - Part 2

  • 1. #forcewebinar Coding Apps in the Cloud with Force.com – Part II March 31st , 2016
  • 2. #forcewebinar#forcewebinar Speakers Shashank Srivatsavaya Sr. Developer Advocate Engineer @shashforce Sonam Raju Sr. Developer Advocate Engineer @sonamraju14
  • 3. Forward Looking Statement 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. Statement under the Private Securities Litigation Reform Act of 1995:
  • 4. #forcewebinar Go Social! @salesforcedevs / #forcewebinar Salesforce Developers Salesforce Developers Salesforce Developers This webinar is being recorded! The video will be posted to YouTube & the webinar recap page (same URL as registration).
  • 5. #forcewebinar Agenda • Part I – Demo • Visualforce Pages • Controllers • Javascript in Visualforce Pages • Part II - Demo • Q&A
  • 6. #forcewebinar Part I : Demo (Data Model, Application, Apex, SOQL, Triggers)
  • 8. #forcewebinar What's a Visualforce Page? ▪ HTML page with tags executed at the server-side to generate dynamic content ▪ Similar to JSP and ASP ▪ Can leverage JavaScript and CSS libraries ▪ The View in MVC architecture
  • 9. #forcewebinar Model-View-Controller Model Data + Rules Controller View-Model interactions View UI code ▪ Separation of concerns – No data access code in view – No view code in controller ▪ Benefits – Minimize impact of changes – More reusable components
  • 10. #forcewebinar Model-View-Controller in Salesforce View • Standard Pages • Visualforce Pages • External apps Controller • Standard Controllers • Controller Extensions • Custom Controllers Model • Objects • Triggers (Apex) • Classes (Apex)
  • 11. #forcewebinar Component Library ▪ Presentation tags – <apex:pageBlock title="My Account Contacts"> ▪ Fine grained data tags – <apex:outputField value="{!contact.firstname}"> – <apex:inputField value="{!contact.firstname}"> ▪ Coarse grained data tags – <apex:detail> – <apex:pageBlockTable> ▪ Action tags – <apex:commandButton action="{!save}" >
  • 12. #forcewebinar Expression Language ▪ Anything inside of {! } is evaluated as an expression ▪ Same expression language as Formulas ▪ $ provides access to global variables (User, RemoteAction, Resource, …) – {! $User.FirstName } {! $User.LastName }
  • 13. #forcewebinar Example 1 • <apex:page> • <h1>Hello, {!$User.FirstName}</h1> • </apex:page>
  • 15. #forcewebinar Standard Controller ▪ A standard controller is available for all objects – You don't have to write it! ▪ Provides standard CRUD operations – Create, Update, Delete, Field Access, etc. ▪ Can be extended with more capabilities ▪ Uses id query string parameter in URL to access object
  • 16. #forcewebinar Example 2 • <apex:page standardController="Contact"> • <apex:form> • <apex:inputField value="{!contact.firstname}"/> • <apex:inputField value="{!contact.lastname}"/> • <apex:commandButton action="{!save}" value="Save"/> • </apex:form> • </apex:page> Function in standard controller Standard controller object
  • 17. #forcewebinar Email Templates Embedded in Page Layouts Generate PDFs Custom Tabs Mobile Interfaces Page Overrides Where can I use Visualforce?
  • 18. #forcewebinar What's a Custom Controller? • Custom class written in Apex • Doesn't work on a specific object • Provides custom data • Provides custom behaviors
  • 19. #forcewebinar Defining a Custom Controller <apex:page controller="FlickrController">
  • 20. #forcewebinar Custom Controller Example public with sharing class FlickrController { public FlickrList getPictures() { HttpRequest req = new HttpRequest(); req.setMethod('GET'); req.setEndpoint('http://api.flickr.com/services/feeds/'); HTTP http = new HTTP(); HTTPResponse res = http.send(req); return (FlickrList) JSON.deserialize(res.getBody(), FlickrList.class); } }
  • 21. #forcewebinar What's a Controller Extension? • Custom class written in Apex • Works on the same object as the standard controller • Can override standard controller behavior • Can add new capabilities
  • 22. #forcewebinar Defining a Controller Extension <apex:page standardController="Speaker__c" extensions="SpeakerCtrlExt"> Provides basic CRUD Overrides standard actions and/or provide additional capabilities
  • 23. #forcewebinar Defining a Controller Extension <apex:page standardController="Speaker__c" extensions="CtrlExt1,CtrlExt2,CtrlExt3"> Provides basic CRUD Can contain multiple extensions
  • 24. #forcewebinar Anatomy of a Controller Extension public class SpeakerCtrlExt { private final Speaker__c speaker; private ApexPages.StandardController stdController; public SpeakerCtrlExt (ApexPages.StandardController ctrl) { this.stdController = ctrl; this.speaker = (Speaker__c)ctrl.getRecord(); } // method overrides // custom methods }
  • 26. #forcewebinar Why Use JavaScript? • Build Engaging User Experiences • Leverage JavaScript Libraries • Build Custom Applications
  • 27. #forcewebinar JavaScript in Visualforce Pages Visualforce Page JavaScript Remoting Remote Objects (REST)
  • 29. #forcewebinar JavaScript Remoting - Server-Side global with sharing class HotelRemoter { @RemoteAction global static List<Hotel__c> findAll() { return [SELECT Id, Name, Location__Latitude__s, Location__Longitude__s FROM Hotel__c]; } }
  • 30. #forcewebinar "global with sharing"? • global • Available from outside of the application • with sharing • Run code with current user permissions. (Apex code runs in system context by default -- with access to all objects and fields)
  • 31. #forcewebinar JavaScript Remoting - Visualforce Page <script> Visualforce.remoting.Manager.invokeAction( '{!$RemoteAction.HotelRemoter.findAll}', function (result, event) { if (event.status) { for (var i = 0; i < result.length; i++) { var lat = result[i].Location__Latitude__s; var lng = result[i].Location__Longitude__s; addMarker(lat, lng); } } else { alert(event.message); } } ); </script>
  • 32. #forcewebinar Using JavaScript and CSS Libraries • Hosted elsewhere <script src="https://maps.googleapis.com/maps/api/js"></script> • Hosted in Salesforce • Upload individual file or Zip file as Static Resource • Reference asset using special tags
  • 34. #forcewebinar Referencing Static Resources // Single file <apex:stylesheet value="{!$Resource.bootstrap}"/> <apex:includeScript value="{!$Resource.jquery}"/> <apex:image url="{!$Resource.logo}"/> // ZIP file <apex:stylesheet value="{!URLFOR($Resource.assets, 'css/main.css')}"/> <apex:image url="{!URLFOR($Resource.assets, 'img/logo.png')}"/> <apex:includeScript value="{!URLFOR($Resource.assets, 'js/app.js')}"/>
  • 35. #forcewebinar Referencing Static Resources // Single file <link href="{!$Resource.bootstrap}" rel="stylesheet"/> <img src="{!$Resource.logo}"/> <script src="{!$Resource.jquery}"></script> // ZIP file <link href="{!URLFOR($Resource.assets, 'css/main.css')}" rel="stylesheet"/> <img src="{!URLFOR($Resource.assets, 'img/logo.png')}"/> <script src="{!URLFOR($Resource.assets, 'js/app.js')}"></script>
  • 36. #forcewebinar Demo (Visualforce with Standard controller and Extension, Custom Controller and Javascript)
  • 40. #forcewebinar#forcewebinar Q&A Your feedback is crucial to the success of our webinar programs. Thank you! http://bit.ly/forcewebinarfeedback
  • 41. #forcewebinar#forcewebinar Thank You Try Trailhead: trailhead.salesforce.com Join the conversation: #forcewebinar @salesforcedevs @SonamRaju14 @shashforce