Using ‘action’ attribute at VF Page tag

By | July 20, 2017

Today in this blog we will discuss the ‘action’ attribute for Visual Page tag. Sometimes there might be a scenario where the Visualforce page need to be rendered based on some calculation or condition for e.g. Display Product Inquiry screen if it is a new customer or display recent Product revisions to existing customers. Salesforce provides a way to define logic before rendering a visualforce page by providing a special attribute called as ‘action’. It is used to define Page-Load actions. This attribute is available for other visualforce tags but here we will be discussing about action attribute in ‘apex: page’ tag. This takes the name of controller method as value and it controls how the Visualforce page should be displayed or any logic to be performed before page loads. This method is called before the page is rendered, and allows to optionally redirect the user to another page or perform some required calculation. Please find below code snippet to demo the use of ‘action’ attribute.

Code snippet to demo use of action attribute

Code snippet to demo use of action attribute

Thus, we can use “action” attribute in the visualforce page for controlling Visualforce page rendering. Also, it should not be used for initialization or DML operations.

Also Read
1. Sending Email Attachment using VF Email Template
2. Creating Global Picklist Value Set in Salesforce
3. Using Nested Lightning Components in Salesforce
4. Expand and Collapse panel using Lightning Component
5. Creating a VisualForce Page with the help of Lightning Design System

About Us
Greytrix is one stop solution provider for Sage ERP and Sage CRM needs. We provide complete end-to-end assistance for your technical consultations, product customization’s, data migration, system integrations, third party add-on development and implementation expertise.

Greytrix have some unique solutions for Cloud CRM such as Salesforce integration with Sage X3, Sage 100 and Sage 300. We also offer best-in-class Cloud CRM Salesforce customization and development services to business partners and end users. Greytrix have some unique solutions for On-Premise CRM such as Sage CRM integration with Sage X3, Sage 100, Sage 300, Sage 500 and Sage 50 . We also offer best-in-class On-Premise Sage CRM customization and development services to business partners and end users.

For more information, please contact us at salesforce@greytrix.com. We will be glad to assist you.