To build custom Web Pages on Salesforce
Visualforce
• Framework to build custom user interfaces on salesforce
• Hosted on force.com
• Build streamlined UX
• Create internal and public facing pages
• Customize for different devices – Responsive
• Leverage other web technologies
What is Visualforce?
Visualforce and MVC Pattern
Model
Controller
View
User Actions
Selects a new view if
required by user action
Controller updates
model as per user actions
View Queries
model for state
Model triggers
View update
Visualforce and MVC Pattern
Your Data
Your Logic
View
User Actions
Selects a new view if
required by user action
Controller updates
model as per user actions
View Queries
model for state
Model triggers
View update
Visualforce and MVC Pattern
Standard and
Custom Objects
Standard
Controllers
and
Apex
View/Pages
User Actions
Selects a new view if
required by user action
Controller updates
model as per user actions
View Queries
model for state
Model triggers
View update
MVC Example in Salesforce
MVC Pattern
Visualforce Pages
Visualforce Components
Standard Controllers
Apex Controllers
Custom UI
Custom Logic
Standard Objects
Custom Objects
• Visualforce tags
– 80+ standard components
– Custom components
• Works with all standard web technologies
including:
– CSS
– Javascript
– HTML
– Flash
– Any other Web-Enabled Code
Visualforce Markup
• Anything inside of {! } is evaluated as an expression
– Dynamic variables: {!Contact.Phone} or {!myApexVariable}
– Logic: {!IF(Opportunity.Stage == ‘Closed/Won’, val_if_true, val_if_false)}
– Functions: {!URLENCODE(Account.website__c)}
• $ provides access to global variables (User, Page, RemoteAction,
Resource, …)
– {!$User.FirstName} {!$User.LastName}
– {!$Resource.jquery}
– {!URLFOR($Resource.assets, ‘img/logo.png’)}
Expression Language
< apex:outputField value = “{!Restaurant__c.Address__c}” >
Standard apex components of visualforce
apex: or chatter:
prefix
Component
name (tables,
repeats, forms,
etc)
Attributes to
define
components
Data binding to
objects and class
variables
Reference field
using dot
notation
Merge field to define
attribute (can also be
a string literal in
some cases)
• Provides access to data
• Logic for handling UI interaction
• Standard Controllers
– Same functionality as standard pages
– Save, delete, field access etc.
• Custom controllers
– Written in Apex
– Override standard behavior
– Controller Extensions
Visualforce controllers
• Developer Console
• Development mode (browser plugin)
• Force.com IDE
Customizing Visualforce
Developer Console
• Embeds a Visualforce page editor in your browser
– see code and preview the page at the same time.
• Also adds Apex editor for editing controllers and extensions.
• To activate: Setup > My personal information > Personal information
Visualforce development mode
Visualforce development mode
Salesforce also made using Visualforce
Possibilities with Visualforce
Email Templates Embedded in Page Layouts Generate PDFs
Custom Tabs
Mobile Interfaces
Page Overrides
• Google charts
• AngularJS and Jquery
• Cookie sessions
• Document uploads
Visualforce integration
• http://developer.force.com/sitesgallery
– Cisco - certification and communities
– Ricoh Australia
– DeVry University
– VMWare – Partner Locator portal
– Force.com appexchange
Over 20,000 websites built on Force.com

Visualforce

  • 1.
    To build customWeb Pages on Salesforce Visualforce
  • 2.
    • Framework tobuild custom user interfaces on salesforce • Hosted on force.com • Build streamlined UX • Create internal and public facing pages • Customize for different devices – Responsive • Leverage other web technologies What is Visualforce?
  • 3.
    Visualforce and MVCPattern Model Controller View User Actions Selects a new view if required by user action Controller updates model as per user actions View Queries model for state Model triggers View update
  • 4.
    Visualforce and MVCPattern Your Data Your Logic View User Actions Selects a new view if required by user action Controller updates model as per user actions View Queries model for state Model triggers View update
  • 5.
    Visualforce and MVCPattern Standard and Custom Objects Standard Controllers and Apex View/Pages User Actions Selects a new view if required by user action Controller updates model as per user actions View Queries model for state Model triggers View update
  • 6.
    MVC Example inSalesforce
  • 7.
    MVC Pattern Visualforce Pages VisualforceComponents Standard Controllers Apex Controllers Custom UI Custom Logic Standard Objects Custom Objects
  • 8.
    • Visualforce tags –80+ standard components – Custom components • Works with all standard web technologies including: – CSS – Javascript – HTML – Flash – Any other Web-Enabled Code Visualforce Markup
  • 9.
    • Anything insideof {! } is evaluated as an expression – Dynamic variables: {!Contact.Phone} or {!myApexVariable} – Logic: {!IF(Opportunity.Stage == ‘Closed/Won’, val_if_true, val_if_false)} – Functions: {!URLENCODE(Account.website__c)} • $ provides access to global variables (User, Page, RemoteAction, Resource, …) – {!$User.FirstName} {!$User.LastName} – {!$Resource.jquery} – {!URLFOR($Resource.assets, ‘img/logo.png’)} Expression Language
  • 10.
    < apex:outputField value= “{!Restaurant__c.Address__c}” > Standard apex components of visualforce apex: or chatter: prefix Component name (tables, repeats, forms, etc) Attributes to define components Data binding to objects and class variables Reference field using dot notation Merge field to define attribute (can also be a string literal in some cases)
  • 11.
    • Provides accessto data • Logic for handling UI interaction • Standard Controllers – Same functionality as standard pages – Save, delete, field access etc. • Custom controllers – Written in Apex – Override standard behavior – Controller Extensions Visualforce controllers
  • 12.
    • Developer Console •Development mode (browser plugin) • Force.com IDE Customizing Visualforce
  • 13.
  • 14.
    • Embeds aVisualforce page editor in your browser – see code and preview the page at the same time. • Also adds Apex editor for editing controllers and extensions. • To activate: Setup > My personal information > Personal information Visualforce development mode
  • 15.
  • 16.
    Salesforce also madeusing Visualforce
  • 17.
    Possibilities with Visualforce EmailTemplates Embedded in Page Layouts Generate PDFs Custom Tabs Mobile Interfaces Page Overrides
  • 18.
    • Google charts •AngularJS and Jquery • Cookie sessions • Document uploads Visualforce integration
  • 19.
    • http://developer.force.com/sitesgallery – Cisco- certification and communities – Ricoh Australia – DeVry University – VMWare – Partner Locator portal – Force.com appexchange Over 20,000 websites built on Force.com