{"id":2652,"date":"2017-07-20T05:34:19","date_gmt":"2017-07-20T05:34:19","guid":{"rendered":"http:\/\/www.greytrix.com\/blogs\/salesforce\/?p=2652"},"modified":"2025-05-09T07:14:24","modified_gmt":"2025-05-09T07:14:24","slug":"using-action-attribute-at-vf-page-tag","status":"publish","type":"post","link":"https:\/\/www.greytrix.com\/blogs\/salesforce\/2017\/07\/20\/using-action-attribute-at-vf-page-tag\/","title":{"rendered":"Using &#8216;action&#8217; attribute at VF Page tag"},"content":{"rendered":"<p style=\"text-align: justify;\">Today in this blog we will discuss the \u2018action\u2019 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 <strong>\u2018action\u2019<\/strong>. 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 \u2018apex: page\u2019 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.<\/p>\n<p><em><strong>Read More:<\/strong><\/em> <a href=\"https:\/\/www.greytrix.com\/product\/crm-development\/salesforce-com\" target=\"_blank\" rel=\"noopener noreferrer\">Salesforce Development Services<\/a><\/p>\n<p style=\"text-align: justify;\">Find below code snippet to demo the use of \u2018action\u2019 attribute.This Method is called before page is rendered and allows you to optionally redirect the user to another page.<\/p>\n<div id=\"attachment_2653\" style=\"width: 694px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2017\/07\/Image1-Code-snippet-to-demo-use-of-action-attribute.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img fetchpriority=\"high\" decoding=\"async\" aria-describedby=\"caption-attachment-2653\" class=\"wp-image-2653 size-full\" title=\"Code snippet to demo use of action attribute\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2017\/07\/Image1-Code-snippet-to-demo-use-of-action-attribute.jpg\" alt=\"Code snippet to demo use of action attribute\" width=\"684\" height=\"363\" \/><\/a><p id=\"caption-attachment-2653\" class=\"wp-caption-text\">Code snippet to demo use of action attribute<\/p><\/div>\n<p style=\"text-align: justify;\">Thus, we can use <strong>\u201caction\u201d<\/strong> attribute in the visualforce page for controlling Visualforce page rendering. Also, it should not be used for initialization or DML operations.<\/p>\n<p><span style=\"font-size: Medium;\"><strong>About Us<\/strong><\/span><br \/>\n<a href=\"https:\/\/www.greytrix.com\/\">Greytrix<\/a>\u00a0as 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.<\/p>\n<p><a href=\"https:\/\/www.greytrix.com\/\">Greytrix<\/a>\u00a0has some unique solutions for Cloud CRM such as Salesforce integration with\u00a0<a href=\"https:\/\/www.greytrix.com\/product\/sage-x3\/gumu-x3-salesforce-integration\">Sage Enterprise Management (Sage X3<\/a>),\u00a0Sage Intacct, <a href=\"https:\/\/www.greytrix.com\/product\/sage-100-erp\/gumu-100-salesforce-integration\">Sage 100\u00a0<\/a>and\u00a0<a href=\"https:\/\/www.greytrix.com\/product\/sage-300-erp\/gumu-300-salesforce-integration\">Sage 300 (Sage Accpac)<\/a>. We also offer best-in-class Cloud CRM\u00a0<a href=\"https:\/\/www.greytrix.com\/product\/crm-development\/salesforce-com\">Salesforce customization and development services<\/a> along with services such as Salesforce <a href=\"https:\/\/www.greytrix.com\/product\/professional-services\/data-migration-services\">Data Migration<\/a>, <a href=\"https:\/\/www.greytrix.com\/product\/professional-services\/integrated-application-development\">Integrated App development<\/a>, <a href=\"https:\/\/www.greytrix.com\/product\/professional-services\/custom-development\">Custom App development<\/a> and <a href=\"https:\/\/www.greytrix.com\/product\/professional-services\/maintenance-support\">Technical Support<\/a> to business partners and end users.<\/p>\n<p>Greytrix GUMU&#x2122; integration for Sage ERP \u2013 Salesforce is a 5-star app listed on <a href=\"https:\/\/appexchange.salesforce.com\/listingDetail?listingId=a0N30000000psM5EAI\" target=\"_blank\" rel=\"noopener\">Salesforce AppExchange<\/a>.<\/p>\n<p>For more information, please contact us at\u00a0<a href=\"mailto:salesforce@greytrix.com\">salesforce@greytrix.com<\/a>. We will be glad to assist you.<\/p>\n<p><span style=\"font-size: Medium;\"><strong>Related Posts<\/strong><\/span><\/p>\n<ul>\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2017\/07\/20\/sending-email-attachment-using-vf-email-template\/\" target=\"_blank\" rel=\"noopener noreferrer\">Sending Email Attachment using VF Email Template<\/a><\/li>\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2017\/07\/18\/creating-global-picklist-value-set-in-salesforce\/\" target=\"_blank\" rel=\"noopener noreferrer\">Creating Global Picklist Value Set in Salesforce<\/a><\/li>\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2017\/07\/14\/using-nested-lightning-components-in-salesforce\/\" target=\"_blank\" rel=\"noopener noreferrer\">Using Nested Lightning Components in Salesforce<\/a><\/li>\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2017\/05\/31\/expand-and-collapse-panel-using-lightning-component\/\" target=\"_blank\" rel=\"noopener noreferrer\">xpand and Collapse panel using Lightning Component<\/a><\/li>\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2017\/05\/03\/creating-a-visualforce-page-with-the-help-of-lightning-design-system\/\" target=\"_blank\" rel=\"noopener noreferrer\">Creating a VisualForce Page with the help of Lightning Design System<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Today in this blog we will discuss the \u2018action\u2019 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\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2017\/07\/20\/using-action-attribute-at-vf-page-tag\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[6,30,869,367,526],"class_list":["post-2652","post","type-post","status-publish","format-standard","hentry","category-salesforce-srv","tag-action-tag","tag-attribute","tag-dml-operations","tag-salesforce","tag-visualforce-page"],"_links":{"self":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/2652","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/comments?post=2652"}],"version-history":[{"count":5,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/2652\/revisions"}],"predecessor-version":[{"id":10673,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/2652\/revisions\/10673"}],"wp:attachment":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/media?parent=2652"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/categories?post=2652"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/tags?post=2652"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}