SlideShare a Scribd company logo
1 of 14
Chapter 5
Standard Controllers
Mohammed S. A. Kwaik
26/8/2013
msabukwaik@gmil.com
www.facebook.com/msabukwaik
Introduction
• A Visualforce controller is a set of instructions that specify what happens
when a user interacts with the components specified in associated
Visualforce markup, such as when a user clicks a button or link. Controllers
also provide access to the data that should be displayed in a page, and can
modify component behavior.
• The Force.com platform provides a number of standard controllers that
contain the same functionality and logic that are used for standard
Salesforce pages. For example, if you use the standard Accounts controller,
clicking a Save button in a Visualforce page results in the same behavior as
clicking Save on a standard Account edit page.
• A standard controller exists for every Salesforce object that can be queried
using the Force.com API.
Introduction
• The following topics include additional information about using
standard controllers:
• Associating a Standard Controller with a Visualforce Page
• Accessing Data with a Standard Controller
• Using Standard Controller Actions
• Validation Rules and Standard Controllers
• Styling Pages that Use Standard Controllers
• Checking for Object Accessibility
• Custom Controllers and Controller Extensions
Associating a Standard Controller with a
Visualforce Page
• Note: When you use the standardController attribute on the
<apex:page> tag, you cannot use the controller attribute at the same
time.
Accessing Data with a Standard Controller
• Every standard controller includes a getter method that returns the
record specified by the id query string parameter in the page URL.
This method allows the associated page markup to reference fields on
the context record by using {!object} syntax, where object is the
lowercase name of the object associated with the controller.
• For example, a page that uses the Account standard controller can
use {!account.name} to return the value of the name field on the
account that is currently in context.
Accessing Data with a Standard Controller
• You can traverse up to five levels of child-to-parent relationships. For
example, if using the Contact standard controller, you can use
{!contact.Account.Owner.FirstName} (a three-level child-to-parent
relationship) to return the name of the owner of the account record
that is associated with the contact.
• You can traverse one level of parent-to-child relationships. For
example, if using the Account standard controller, you can use
{!account.Contacts} to return an array of all contacts associated with
the account that is currently in context.
Using Standard Controller Actions
• Action methods perform logic or navigation when a page event
occurs, such as when a user clicks a button, or hovers over an area of
the page. Action methods can be called from page markup by using
{! } notation in the action parameter of one of the following tags:
• <apex:commandButton> creates a button that calls an action
• <apex:commandLink> creates a link that calls an action
• <apex:actionPoller> periodically calls an action
• <apex:actionSupport> makes an event (such as “onclick”, “onmouseover”,
and so on) on another, named component, call an action
• <apex:actionFunction> defines a new JavaScript function that calls an action
• <apex:page> calls an action when the page is loaded
Using Standard Controller Actions
• The following table describes the action methods that are supported
by all standard controllers. You can associate these actions with any
Visualforce component that includes an action attribute.
Action Description
save Inserts a new record or updates an existing record if it is currently in context. After this
operation is finished, the save action returns the user to the original page (if known),
or navigates the user to the detail page for the saved record.
quicksave Inserts a new record or updates an existing record if it is currently in context. Unlike
the save action, this page does not redirect the user to another page.
edit Navigates the user to the edit page for the record that is currently in context. After this
operation is finished, the edit action returns the user to the page where the user
originally invoked the action.
Using Standard Controller Actions
Action Description
delete Deletes the record that is currently in content. After this operation is finished, the
delete action either refreshes the page or sends the user to tab for the associated
object.
cancel Aborts an edit operation. After this operation is finished, the cancel action returns the
user to the page where the user originally invoked the edit.
List Returns a PageReference object of the standard list page, based on the most recently
used list filter for that object. For example, if the standard controller is contact, and the
last filtered list that the user viewed is New Last Week, the contacts created in the last
week are displayed.
Using Standard Controller Actions
Validation Rules and Standard Controllers
• If a user enters data on a Visualforce page that uses a standard
controller, and that data causes a validation rule error, the error can
be displayed on the Visualforce page. If the validation rule error
location is a field associated with an <apex:inputField> component,
the error displays there. If the validation rule error location is set to
the top of the page, use the <apex:pageMessages> or
<apex:messages> component within the <apex:page> to display the
error.
Styling Pages that Use Standard Controllers
• Any page associated with a standard controller automatically inherits
the style that is used for standard Salesforce pages associated with
the specified object. That is, the tab for the specified object appears
selected, and the associated color of the tab is used to style all page
elements.
• You can override the styling of a page that uses a standard controller
with the tabStyle attribute on the <apex:page> tag.
Checking for Object Accessibility
• If a user has insufficient privileges to view an object, any Visualforce
page that uses a controller to render that object will be inaccessible.
To avoid this error, you should ensure that your Visualforce
components will only render if a user has access to the object
associated with the controller.
Checking for Object Accessibility
• It is good practice to provide an alternative message if a user cannot
access an object. For example:

More Related Content

What's hot

Less10 2 e_testermodule_9
Less10 2 e_testermodule_9Less10 2 e_testermodule_9
Less10 2 e_testermodule_9Suresh Mishra
 
User and group security migration
User and group security migrationUser and group security migration
User and group security migrationAmit Sharma
 
Oracle Config Pres_Shashank
Oracle Config Pres_ShashankOracle Config Pres_Shashank
Oracle Config Pres_ShashankShashank Anand
 
Introduction to apex code
Introduction to apex codeIntroduction to apex code
Introduction to apex codeEdwinOstos
 
Oracle apex-hands-on-guide lab#1
Oracle apex-hands-on-guide lab#1Oracle apex-hands-on-guide lab#1
Oracle apex-hands-on-guide lab#1Amit Sharma
 
Less08 2 e_testermodule_7
Less08 2 e_testermodule_7Less08 2 e_testermodule_7
Less08 2 e_testermodule_7Suresh Mishra
 
Custom controls
Custom controlsCustom controls
Custom controlsaspnet123
 
Custom control in asp.net
Custom control in asp.netCustom control in asp.net
Custom control in asp.netSireesh K
 
Custom Controls in ASP.net
Custom Controls in ASP.netCustom Controls in ASP.net
Custom Controls in ASP.netkunj desai
 
Software design with Domain-driven design
Software design with Domain-driven design Software design with Domain-driven design
Software design with Domain-driven design Allan Mangune
 
OBIEE 11g: Configuring LDAP Server
OBIEE 11g: Configuring LDAP Server  OBIEE 11g: Configuring LDAP Server
OBIEE 11g: Configuring LDAP Server adivasoft
 
BI Publisher Data model design document
BI Publisher Data model design documentBI Publisher Data model design document
BI Publisher Data model design documentadivasoft
 
Force.com migration utility
Force.com migration utilityForce.com migration utility
Force.com migration utilityAmit Sharma
 
Customizing sales force-interface
Customizing sales force-interfaceCustomizing sales force-interface
Customizing sales force-interfaceAmit Sharma
 
Less11 3 e_loadmodule_1
Less11 3 e_loadmodule_1Less11 3 e_loadmodule_1
Less11 3 e_loadmodule_1Suresh Mishra
 
OBIEE11g Multi User Development - MUD
OBIEE11g  Multi User Development - MUDOBIEE11g  Multi User Development - MUD
OBIEE11g Multi User Development - MUDadivasoft
 

What's hot (20)

Less10 2 e_testermodule_9
Less10 2 e_testermodule_9Less10 2 e_testermodule_9
Less10 2 e_testermodule_9
 
User and group security migration
User and group security migrationUser and group security migration
User and group security migration
 
Oracle Config Pres_Shashank
Oracle Config Pres_ShashankOracle Config Pres_Shashank
Oracle Config Pres_Shashank
 
Governor limits
Governor limitsGovernor limits
Governor limits
 
Mvc
MvcMvc
Mvc
 
Introduction to apex code
Introduction to apex codeIntroduction to apex code
Introduction to apex code
 
Oracle apex-hands-on-guide lab#1
Oracle apex-hands-on-guide lab#1Oracle apex-hands-on-guide lab#1
Oracle apex-hands-on-guide lab#1
 
Less08 2 e_testermodule_7
Less08 2 e_testermodule_7Less08 2 e_testermodule_7
Less08 2 e_testermodule_7
 
Custom controls
Custom controlsCustom controls
Custom controls
 
Custom control in asp.net
Custom control in asp.netCustom control in asp.net
Custom control in asp.net
 
Rails review
Rails reviewRails review
Rails review
 
Custom Controls in ASP.net
Custom Controls in ASP.netCustom Controls in ASP.net
Custom Controls in ASP.net
 
Software design with Domain-driven design
Software design with Domain-driven design Software design with Domain-driven design
Software design with Domain-driven design
 
OBIEE 11g: Configuring LDAP Server
OBIEE 11g: Configuring LDAP Server  OBIEE 11g: Configuring LDAP Server
OBIEE 11g: Configuring LDAP Server
 
BI Publisher Data model design document
BI Publisher Data model design documentBI Publisher Data model design document
BI Publisher Data model design document
 
Force.com migration utility
Force.com migration utilityForce.com migration utility
Force.com migration utility
 
Kentico and MVC
Kentico and MVCKentico and MVC
Kentico and MVC
 
Customizing sales force-interface
Customizing sales force-interfaceCustomizing sales force-interface
Customizing sales force-interface
 
Less11 3 e_loadmodule_1
Less11 3 e_loadmodule_1Less11 3 e_loadmodule_1
Less11 3 e_loadmodule_1
 
OBIEE11g Multi User Development - MUD
OBIEE11g  Multi User Development - MUDOBIEE11g  Multi User Development - MUD
OBIEE11g Multi User Development - MUD
 

Viewers also liked

Atl elevate programmatic developer slides
Atl elevate programmatic developer slidesAtl elevate programmatic developer slides
Atl elevate programmatic developer slidesDavid Scruggs
 
Salesforce1 Analytics API Hands-On Training
Salesforce1 Analytics API Hands-On TrainingSalesforce1 Analytics API Hands-On Training
Salesforce1 Analytics API Hands-On TrainingSalesforce Developers
 
Salesforce for Beginners
Salesforce for BeginnersSalesforce for Beginners
Salesforce for BeginnersEdureka!
 
How to install and configure vBulletin 5 beta 13
How to install and  configure vBulletin 5  beta 13 How to install and  configure vBulletin 5  beta 13
How to install and configure vBulletin 5 beta 13 Mohammed Safwat Abu Kwaik
 
Research of sewage & cleanliness using chi square analysis
Research of sewage & cleanliness using chi square analysisResearch of sewage & cleanliness using chi square analysis
Research of sewage & cleanliness using chi square analysisEr Sunil Gupta
 
Customizing the Appearance and HTML Output of Visualforce Pages
Customizing the Appearance and HTML Output of VisualforcePages Customizing the Appearance and HTML Output of VisualforcePages
Customizing the Appearance and HTML Output of Visualforce Pages Mohammed Safwat Abu Kwaik
 
Mongolia’s meat supply chain analysis
Mongolia’s meat supply chain analysisMongolia’s meat supply chain analysis
Mongolia’s meat supply chain analysisKhulan Altangerel
 
Central drug standard control organisation
Central drug standard control organisationCentral drug standard control organisation
Central drug standard control organisationbdvfgbdhg
 
Controller ppt
Controller pptController ppt
Controller pptgourav0077
 
Powerpoint bd 7º6 pca
Powerpoint bd 7º6 pcaPowerpoint bd 7º6 pca
Powerpoint bd 7º6 pcaimavpjc
 

Viewers also liked (20)

Atl elevate programmatic developer slides
Atl elevate programmatic developer slidesAtl elevate programmatic developer slides
Atl elevate programmatic developer slides
 
Salesforce1 Analytics API Hands-On Training
Salesforce1 Analytics API Hands-On TrainingSalesforce1 Analytics API Hands-On Training
Salesforce1 Analytics API Hands-On Training
 
Salesforce for Beginners
Salesforce for BeginnersSalesforce for Beginners
Salesforce for Beginners
 
Apostrophes
ApostrophesApostrophes
Apostrophes
 
How to use vbsso
How to use vbsso How to use vbsso
How to use vbsso
 
Do now
Do nowDo now
Do now
 
Homophone+homograph
Homophone+homographHomophone+homograph
Homophone+homograph
 
How to install and configure vBulletin 5 beta 13
How to install and  configure vBulletin 5  beta 13 How to install and  configure vBulletin 5  beta 13
How to install and configure vBulletin 5 beta 13
 
Research of sewage & cleanliness using chi square analysis
Research of sewage & cleanliness using chi square analysisResearch of sewage & cleanliness using chi square analysis
Research of sewage & cleanliness using chi square analysis
 
Install vb5 beta 13
Install vb5 beta 13 Install vb5 beta 13
Install vb5 beta 13
 
Python
PythonPython
Python
 
Getting a Quick Start with Visualforce
Getting a Quick Start with Visualforce Getting a Quick Start with Visualforce
Getting a Quick Start with Visualforce
 
Customizing the Appearance and HTML Output of Visualforce Pages
Customizing the Appearance and HTML Output of VisualforcePages Customizing the Appearance and HTML Output of VisualforcePages
Customizing the Appearance and HTML Output of Visualforce Pages
 
Vf ppt (1)
Vf ppt (1)Vf ppt (1)
Vf ppt (1)
 
Introduction to Apex for Developers
Introduction to Apex for DevelopersIntroduction to Apex for Developers
Introduction to Apex for Developers
 
Mongolia’s meat supply chain analysis
Mongolia’s meat supply chain analysisMongolia’s meat supply chain analysis
Mongolia’s meat supply chain analysis
 
Central drug standard control organisation
Central drug standard control organisationCentral drug standard control organisation
Central drug standard control organisation
 
Controller ppt
Controller pptController ppt
Controller ppt
 
Controlling ppt
Controlling pptControlling ppt
Controlling ppt
 
Powerpoint bd 7º6 pca
Powerpoint bd 7º6 pcaPowerpoint bd 7º6 pca
Powerpoint bd 7º6 pca
 

Similar to Standard Controllers

SFDC UI - Introduction to Visualforce
SFDC UI -  Introduction to VisualforceSFDC UI -  Introduction to Visualforce
SFDC UI - Introduction to VisualforceSujit Kumar
 
Customizing sales force-interface
Customizing sales force-interfaceCustomizing sales force-interface
Customizing sales force-interfaceAmit Sharma
 
Parallelminds.asp.net with sp
Parallelminds.asp.net with spParallelminds.asp.net with sp
Parallelminds.asp.net with spparallelminder
 
03 asp.net session04
03 asp.net session0403 asp.net session04
03 asp.net session04Vivek chan
 
SFDC UI - Advanced Visualforce
SFDC UI - Advanced VisualforceSFDC UI - Advanced Visualforce
SFDC UI - Advanced VisualforceSujit Kumar
 
11 asp.net session16
11 asp.net session1611 asp.net session16
11 asp.net session16Vivek chan
 
Aspnet life cycle events
Aspnet life cycle eventsAspnet life cycle events
Aspnet life cycle eventsTrushant parkar
 
12 asp.net session17
12 asp.net session1712 asp.net session17
12 asp.net session17Vivek chan
 
Document about the Activities in Pega.ppt
Document about the Activities in Pega.pptDocument about the Activities in Pega.ppt
Document about the Activities in Pega.pptssuser0718431
 
Lecture31-Web-based-testing-I.pptx
Lecture31-Web-based-testing-I.pptxLecture31-Web-based-testing-I.pptx
Lecture31-Web-based-testing-I.pptxBalkrishanpatidar
 
Lecture31-Web-based-testing-I.pptx
Lecture31-Web-based-testing-I.pptxLecture31-Web-based-testing-I.pptx
Lecture31-Web-based-testing-I.pptxBalkrishanpatidar
 
Lecture31-Web-based-testing-I.pptx
Lecture31-Web-based-testing-I.pptxLecture31-Web-based-testing-I.pptx
Lecture31-Web-based-testing-I.pptxBalkrishanpatidar
 
11 asp.net session16
11 asp.net session1611 asp.net session16
11 asp.net session16Niit Care
 
16 asp.net session23
16 asp.net session2316 asp.net session23
16 asp.net session23Vivek chan
 
Coding the Salesforce1 Platform User Interface
Coding the Salesforce1 Platform User InterfaceCoding the Salesforce1 Platform User Interface
Coding the Salesforce1 Platform User InterfaceKeir Bowden
 

Similar to Standard Controllers (20)

SFDC UI - Introduction to Visualforce
SFDC UI -  Introduction to VisualforceSFDC UI -  Introduction to Visualforce
SFDC UI - Introduction to Visualforce
 
Asp PPT (.NET )
Asp PPT (.NET )Asp PPT (.NET )
Asp PPT (.NET )
 
Customizing sales force-interface
Customizing sales force-interfaceCustomizing sales force-interface
Customizing sales force-interface
 
Parallelminds.asp.net with sp
Parallelminds.asp.net with spParallelminds.asp.net with sp
Parallelminds.asp.net with sp
 
03 asp.net session04
03 asp.net session0403 asp.net session04
03 asp.net session04
 
SFDC UI - Advanced Visualforce
SFDC UI - Advanced VisualforceSFDC UI - Advanced Visualforce
SFDC UI - Advanced Visualforce
 
11 asp.net session16
11 asp.net session1611 asp.net session16
11 asp.net session16
 
Chapter12 (1)
Chapter12 (1)Chapter12 (1)
Chapter12 (1)
 
Aspnet life cycle events
Aspnet life cycle eventsAspnet life cycle events
Aspnet life cycle events
 
12 asp.net session17
12 asp.net session1712 asp.net session17
12 asp.net session17
 
Standard control in asp.net
Standard control in asp.netStandard control in asp.net
Standard control in asp.net
 
Document about the Activities in Pega.ppt
Document about the Activities in Pega.pptDocument about the Activities in Pega.ppt
Document about the Activities in Pega.ppt
 
WSS MOSS Portfolio
WSS MOSS PortfolioWSS MOSS Portfolio
WSS MOSS Portfolio
 
Web controls
Web controlsWeb controls
Web controls
 
Lecture31-Web-based-testing-I.pptx
Lecture31-Web-based-testing-I.pptxLecture31-Web-based-testing-I.pptx
Lecture31-Web-based-testing-I.pptx
 
Lecture31-Web-based-testing-I.pptx
Lecture31-Web-based-testing-I.pptxLecture31-Web-based-testing-I.pptx
Lecture31-Web-based-testing-I.pptx
 
Lecture31-Web-based-testing-I.pptx
Lecture31-Web-based-testing-I.pptxLecture31-Web-based-testing-I.pptx
Lecture31-Web-based-testing-I.pptx
 
11 asp.net session16
11 asp.net session1611 asp.net session16
11 asp.net session16
 
16 asp.net session23
16 asp.net session2316 asp.net session23
16 asp.net session23
 
Coding the Salesforce1 Platform User Interface
Coding the Salesforce1 Platform User InterfaceCoding the Salesforce1 Platform User Interface
Coding the Salesforce1 Platform User Interface
 

Recently uploaded

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 

Recently uploaded (20)

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 

Standard Controllers

  • 1. Chapter 5 Standard Controllers Mohammed S. A. Kwaik 26/8/2013 msabukwaik@gmil.com www.facebook.com/msabukwaik
  • 2. Introduction • A Visualforce controller is a set of instructions that specify what happens when a user interacts with the components specified in associated Visualforce markup, such as when a user clicks a button or link. Controllers also provide access to the data that should be displayed in a page, and can modify component behavior. • The Force.com platform provides a number of standard controllers that contain the same functionality and logic that are used for standard Salesforce pages. For example, if you use the standard Accounts controller, clicking a Save button in a Visualforce page results in the same behavior as clicking Save on a standard Account edit page. • A standard controller exists for every Salesforce object that can be queried using the Force.com API.
  • 3. Introduction • The following topics include additional information about using standard controllers: • Associating a Standard Controller with a Visualforce Page • Accessing Data with a Standard Controller • Using Standard Controller Actions • Validation Rules and Standard Controllers • Styling Pages that Use Standard Controllers • Checking for Object Accessibility • Custom Controllers and Controller Extensions
  • 4. Associating a Standard Controller with a Visualforce Page • Note: When you use the standardController attribute on the <apex:page> tag, you cannot use the controller attribute at the same time.
  • 5. Accessing Data with a Standard Controller • Every standard controller includes a getter method that returns the record specified by the id query string parameter in the page URL. This method allows the associated page markup to reference fields on the context record by using {!object} syntax, where object is the lowercase name of the object associated with the controller. • For example, a page that uses the Account standard controller can use {!account.name} to return the value of the name field on the account that is currently in context.
  • 6. Accessing Data with a Standard Controller • You can traverse up to five levels of child-to-parent relationships. For example, if using the Contact standard controller, you can use {!contact.Account.Owner.FirstName} (a three-level child-to-parent relationship) to return the name of the owner of the account record that is associated with the contact. • You can traverse one level of parent-to-child relationships. For example, if using the Account standard controller, you can use {!account.Contacts} to return an array of all contacts associated with the account that is currently in context.
  • 7. Using Standard Controller Actions • Action methods perform logic or navigation when a page event occurs, such as when a user clicks a button, or hovers over an area of the page. Action methods can be called from page markup by using {! } notation in the action parameter of one of the following tags: • <apex:commandButton> creates a button that calls an action • <apex:commandLink> creates a link that calls an action • <apex:actionPoller> periodically calls an action • <apex:actionSupport> makes an event (such as “onclick”, “onmouseover”, and so on) on another, named component, call an action • <apex:actionFunction> defines a new JavaScript function that calls an action • <apex:page> calls an action when the page is loaded
  • 8. Using Standard Controller Actions • The following table describes the action methods that are supported by all standard controllers. You can associate these actions with any Visualforce component that includes an action attribute. Action Description save Inserts a new record or updates an existing record if it is currently in context. After this operation is finished, the save action returns the user to the original page (if known), or navigates the user to the detail page for the saved record. quicksave Inserts a new record or updates an existing record if it is currently in context. Unlike the save action, this page does not redirect the user to another page. edit Navigates the user to the edit page for the record that is currently in context. After this operation is finished, the edit action returns the user to the page where the user originally invoked the action.
  • 9. Using Standard Controller Actions Action Description delete Deletes the record that is currently in content. After this operation is finished, the delete action either refreshes the page or sends the user to tab for the associated object. cancel Aborts an edit operation. After this operation is finished, the cancel action returns the user to the page where the user originally invoked the edit. List Returns a PageReference object of the standard list page, based on the most recently used list filter for that object. For example, if the standard controller is contact, and the last filtered list that the user viewed is New Last Week, the contacts created in the last week are displayed.
  • 11. Validation Rules and Standard Controllers • If a user enters data on a Visualforce page that uses a standard controller, and that data causes a validation rule error, the error can be displayed on the Visualforce page. If the validation rule error location is a field associated with an <apex:inputField> component, the error displays there. If the validation rule error location is set to the top of the page, use the <apex:pageMessages> or <apex:messages> component within the <apex:page> to display the error.
  • 12. Styling Pages that Use Standard Controllers • Any page associated with a standard controller automatically inherits the style that is used for standard Salesforce pages associated with the specified object. That is, the tab for the specified object appears selected, and the associated color of the tab is used to style all page elements. • You can override the styling of a page that uses a standard controller with the tabStyle attribute on the <apex:page> tag.
  • 13. Checking for Object Accessibility • If a user has insufficient privileges to view an object, any Visualforce page that uses a controller to render that object will be inaccessible. To avoid this error, you should ensure that your Visualforce components will only render if a user has access to the object associated with the controller.
  • 14. Checking for Object Accessibility • It is good practice to provide an alternative message if a user cannot access an object. For example:

Editor's Notes

  1. <apex:page standardController="Course__c" > </apex:page>
  2. <apex:page standardController="Account"> <apex:form > <apex:pageBlock title="My Content" mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Save"/> </apex:pageBlockButtons> <apex:pageBlockSection title="My Content Section" columns="2"> <apex:inputField value="{!account.name}"/> <apex:inputField value="{!account.site}"/> <apex:inputField value="{!account.type}"/> <apex:inputField value="{!account.accountNumber}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
  3. <apex:page standardController="Account" tabStyle="Opportunity"> </apex:page>
  4. <apex:page standardController="Lead"> <apex:pageBlock rendered="{!$ObjectType.Lead.accessible}"> <p>This text will display if you can see the Lead object.</p> </apex:pageBlock> </apex:page>
  5. <apex:page standardController="Lead"> <apex:pageBlock rendered="{!$ObjectType.Lead.accessible}"> <p>This text will display if you can see the Lead object.</p> </apex:pageBlock> <apex:pageBlock rendered="NOT({!$ObjectType.Lead.accessible})"> <p>Sorry, but you cannot see the data because you do not have access to the Lead object.</p> </apex:pageBlock> </apex:page>