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 needs to be rendered based on some calculation or condition for e.g. Display Product Inquiry screen if it is a new customer or displays 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 action attribute in ‘apex: page’ tag. This takes the name of the 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.

Read More: Salesforce Development Services

Find below code snippet to demo the use of ‘action’ attribute.This Method is called before page is rendered and allows you to optionally redirect the user to another page.

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.

About Us
Greytrix as a Salesforce Product development partner offers a wide variety of integration products and services to the end users as well as to the Partners across the globe. We offer Consultation, Configuration, Training and support services in out-of-the-box functionality as well as customizations to incorporate custom business rules and functionalities that require apex code incorporation into the Salesforce platform.

Greytrix has some unique solutions for Cloud CRM such as Salesforce integration with Sage Enterprise Management (Sage X3), Sage Intacct, Sage 100 and Sage 300 (Sage Accpac). We also offer best-in-class Cloud CRM Salesforce customization and development services along with services such as Salesforce Data Migration, Integrated App development, Custom App development and Technical Support to business partners and end users.

Greytrix GUMU™ integration for Sage ERP – Salesforce is a 5-star app listed on Salesforce AppExchange.

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

Related Posts