Grab Deal : Flat 30% off on live classes + 2 free self-paced courses! - SCHEDULE CALL

- Salesforce Blogs -

Apex:Actionfunction In The Salesforce VisualForce Page


JavaScript is the dynamic scripting language that performs actions on the client side. With the help of JS, it is possible reducing traffic on the web server. There are two popular Apex functions the Salesforce - and that are used in a Visualforce page to execute different JavaScript tasks. Our main focus is to discuss in this blog that provides support to invoke controller action methods directly from the JS code using an AJAX request. In case, you are actively looking for a potential career in Salesforce professional, consider enrolling in a professional Online Salesforce Training course.

An must be the subset or child of component as binding between the caller and the apex function is done based on the order of parameters and makes sure that the order of parameters matches completely with the arguments list of the caller. An defines the new JavaScript function that can be called within a block of JS code. At the same time, one more popular method only provides support for invoking controller action methods.

Based on the API version 23, it is not possible using within an iteration component. The best idea is to put this Apex function after the iteration component and put a simple JavaScript code within an iteration component.

Before we move to the apex attributes, if you are seriously planning to begin your career in Salesforce should think about going for a Salesforce Cloud Course to land their career on the right path.

What are the Attributes?

  • Attribute name -

This attribute is invoked when the actionFunction is called by the DOM event elsewhere in the page markup. You may use merge-field syntax for method referencing. For example, action = “{save}” references the save method in the controller. When an action is not specified, the page refreshes automatically.

  • Attribute name -

It represents the ID of the omponent that is in focus when AJAX request completes.

  • Attribute name -

It is an identifier that allows the actionFunction component to be referenced by other components in the page.

  • Attribute name -

It is a Boolean value that specifies whether the action associated with the component should happen immediately or not. It does not any validation rules associated with fields on the page. If it is set to true then action happens immediately and validation rules are skipped automatically. If there is no value defined for the attribute then it is set to false by default. 

  • Attribute name -

It includes the name of JavaScript function when the function is executed somewhere else in the page markup causes the method specified by action attribute to execute. As soon as the action method completes, the components specified by the reRender attribute are refreshed.

  • Attribute name -

The namespace is used for the generated JavaScript function. The attribute of namespace should be a simple string, beginning with a letter and consists of only letters, numbers, or the underscore character. For example, your app_name_version is supported as namespaces. If no namespace is added to the JavaScript functions that are generated by the , then it preserves the existing behavior.

  • Attribute name -

The JavaScript function invoked when the result of an Apex update request completes on the client.

  • Attribute name -

It includes the Boolean value that specifies whether the component is rendered or not on the web page. If not specified, the value is set to true by default.

  • Attribute name -

It shows the ID of one or more components that are redrawn when the result of the action method returns to the client. The final value can be an individual ID, a comma-separated list of multiple IDs, a merge field expression for the list of the collection of IDs.

  • Attribute name -

It is the ID of an associated component that displays the status of an AJAX update request. 

  • Attribute name -

It shows the amount of time in milliseconds before an AJAX request should time out. Meanwhile, we recommend you to go through various Salesforce blogs available on the JanBask Training which may really increase your knowledge and answer your queries related to Salesforce.

Next, we will check the need for action tags in Salesforce.

Why Action Tags are Needed in Salesforce?

It is possible creating Visualforce pages by invoking controller methods using AJAX requests. There is the case you want to use AJAX in the Visualforce page so that a particular part of the page can be refreshed and performs specified actions when the user clicks on a button. We can use multiple action tags in this case that are supported by the AJAX request. 

This action tag must be called from the client-side event or from a custom JavaScript function. It generally behaves like any other JavaScript function that has the capability to communicate with server methods using the “action” attribute. Keep in mind that action attribute is optional here that should be used when required. This action tag can also refresh the VF function on the client-side event using the reRender attribute. 

This action tag adds AJAX support to another Visualforce component and then call the controller method. For example, we wanted to implement the search functionality where we need instant results for each keyword that matches the content. Here, we need to add AJAX support to the InputText that calls a function and returns the needed result.

This action tag acts as the timer on the Visualforce page. It is used to send the AJAX request to the server depending on the time interval. In case, the time span is not specified then it is taken 60 seconds by default. 

For example, we want to update the account list in every 5 seconds. It will show every new account on the Visualforce page as soon as added. It is clear from the discussion that this action tag is used for the component that we want to refresh in every few seconds. If you don’t want to refresh the component frequently then you should use in this case.

These were the tags required in Salesforce. Now, we will go through the process of passing parameters between Apex and Visualforce. 

Tip: The top customer relationship management (CRM) platform in the world is Salesforce. Take this free, 2-minute Salesforce quiz to see how much you know about the platform and to keep up with new developments.

How to Pass Parameters Between Apex and Visualforce?

When the user clicks a link, we want to pass the ID to the Apex method. The APEX method then returns to us a URL string. We open a new window here that loads that needed URL. We can call parameters and variables from Visualforce pages but passing parameters or variables to and forth between Apex methods and Visualforce is not intuitive. However, it is impossible passing parameters from a Visualforce page to the Apex method directly.

  • Not Supported: It is possible calling Apex method from a Visualforce page directly if parameters are required.
  • Supported: It is possible calling Apex method from a Visualforce page if there are no parameters.

So, how to pass the ID parameter to the Apex method from the Visualforce page. Well, Apex class is the solution here that help to initialize variables outside the method since parameters cannot be passed from Visualforce page directly. We need to declare actionFunction here that works similar to the Apex method. When you call this action tag, you are free to add multiple parameters between Apex and Visualforce methods here. 

Also, consider joining the JanBask Salesforce community to keep yourself updated with the latest Salesforce trends and career opportunities. 


With this discussion, you must be sure of what is Apex:actionFunction method and how it helps in multiple ways to invoke controller methods using different action control attributes. There are more similar methods too that are also discussed in brief because the main objective of this blog is to discuss the concept of Apex:actionFunction in detail. To know more about tough Apex methods and controllers, join the Salesforce certification program and learn to use different control tags practically with the right experts’ assistance.

Frequently Asked Questions

Q1. What is the Apex attribute? 

Ans: A description of a custom component's attribute. Only a component tag can have an attribute tag as a child. Please take note that properties with names like id or rendered cannot be defined. All custom component definitions automatically create these characteristics.

Q2. What does Salesforce's apex component mean?

Ans:  A  designation that enables other tags in the component definition to use the component as a reference. The language that is used to display labels that have Salesforce-related translations. The language of the person viewing the component is superseded by this value.

Q3. How do I use Apex param in Salesforce? 

Ans: We have used param twice on the VF page: once in the command button and once in the actionfunction. A value has been assigned to the parameter that is in the command button as well as to a variable in the controller. If the button is clicked, this value will be sent to the controller's variable.

Q4.  In Salesforce, how can I use Apex param? 

Ans: We have used param twice on the VF page: once in the command button and once in the actionfunction. A value has been assigned to the parameter that is in the command button as well as to a variable in the controller. If the button is clicked, this value will be sent to the controller's variable.

Q5. What do Salesforce's Apex and Visual Force mean? 

Ans: Web service requests and triggers on objects can both start Apex code. With the help of the Visualforce framework, programmers may create complex, unique user interfaces that can be hosted natively on the Lightning Platform.

Q6.  What is the objective of the Salesforce course?

Ans- This course on Salesforce Admin training online has been prepared as an aid for those students who wish to master the concepts of Salesforce Administration more comprehensively.The Salesforce Admin course online that we have to offer ensures a thorough job success and also aids you to clear the certification exam with all the skills that have been gathered by the aid of carefully customized Salesforce admin training materials and the practical assignments.

Q7. What learning benefits can I get from JanBask Training?
Ans- At JanBask Training-

  • All the sessions are conducted in a real-time environment
  • The learners are put in a collaborative ecosystem of learning
  • Surprise quizzes, live debates are a part of learner’s daily routines
  • The course covers Salesforce Admin as well as Developer concepts
  • It is a comprehensive training that covers practical and theoretical training
  • It comes with a varied and interesting range of Salesforce admin training material or learning resources.

Q8. Which Salesforce admin certifications are in-demand?

Ans- Salesforce currently offers two stages of administrator certifications:

  • Certified Administrator and
  • Certified Advanced Administrator

Both these certifications are designed and necessary for those professionals who wish to focus on Salesforce’s administrative side functions of an already existing Salesforce solution regime.

Q9. Is it tough to get a job in Salesforce? 

Ans: Despite the fact that it's not unheard of for someone to land a job with just a Salesforce Certification, most occupations require some sort of relevant work experience. This is the classic "chicken and egg" scenario in which neither experience nor employment can be obtained without the other.

Q10. Which qualification is needed for Salesforce? 

Ans: The ideal candidate should be an administrative professional with a BE-A degree and a background in Salesforce. They should also have a BBA, BCA, or MCA. Developers, Administrators, authors, journalists, and analysts can all benefit from the internationally recognized Admin certification.

What are the benefits of doing LIVE sessions in the training program?
Ans- At the first step, we will brush up your skills concerning the fundamentals of Salesforce Service Cloud.

  • You will learn to implement Lightning service console, multiple support processes, custom service apps, Salesforce knowledge, Salesforce LIVE Agent, etc.
  • Once you are done advanced Salesforce Service Cloud Training, you can apply for the certification and get Salesforce certified by acquiring the right skills and knowledge.
  • In the end, start applying for jobs in the Salesforce Service Cloud domain and be a recognized professional as always needed by you at the intermediate and advanced level.

Q10. Can I get access to the class in case I miss it?
Ans- Yes, you can access the same class again in our recorded class sessions. OUR Learning Management System records each live session that can be viewed later when you need it.                                                     


fbicons FaceBook twitterTwitter lingedinLinkedIn pinterest Pinterest emailEmail


    Shubham Singh

    With his detailed research and unique insights into IT and Technological trends, Shubham has been producing high-quality and engaging content that meets the standards of its end-users.


Trending Courses

Cyber Security Course

Cyber Security

  • Introduction to cybersecurity
  • Cryptography and Secure Communication 
  • Cloud Computing Architectural Framework
  • Security Architectures and Models
Cyber Security Course

Upcoming Class

12 days 05 Jul 2024

QA Course


  • Introduction and Software Testing
  • Software Test Life Cycle
  • Automation Testing and API Testing
  • Selenium framework development using Testing
QA Course

Upcoming Class

5 days 28 Jun 2024

Salesforce Course


  • Salesforce Configuration Introduction
  • Security & Automation Process
  • Sales & Service Cloud
  • Apex Programming, SOQL & SOSL
Salesforce Course

Upcoming Class

3 days 26 Jun 2024

Business Analyst Course

Business Analyst

  • BA & Stakeholders Overview
  • BPMN, Requirement Elicitation
  • BA Tools & Design Documents
  • Enterprise Analysis, Agile & Scrum
Business Analyst Course

Upcoming Class

-0 day 23 Jun 2024

MS SQL Server Course

MS SQL Server

  • Introduction & Database Query
  • Programming, Indexes & System Functions
  • SSIS Package Development Procedures
  • SSRS Report Design
MS SQL Server Course

Upcoming Class

5 days 28 Jun 2024

Data Science Course

Data Science

  • Data Science Introduction
  • Hadoop and Spark Overview
  • Python & Intro to R Programming
  • Machine Learning
Data Science Course

Upcoming Class

6 days 29 Jun 2024

DevOps Course


  • Intro to DevOps
  • GIT and Maven
  • Jenkins & Ansible
  • Docker and Cloud Computing
DevOps Course

Upcoming Class

1 day 24 Jun 2024

Hadoop Course


  • Architecture, HDFS & MapReduce
  • Unix Shell & Apache Pig Installation
  • HIVE Installation & User-Defined Functions
  • SQOOP & Hbase Installation
Hadoop Course

Upcoming Class

12 days 05 Jul 2024

Python Course


  • Features of Python
  • Python Editors and IDEs
  • Data types and Variables
  • Python File Operation
Python Course

Upcoming Class

13 days 06 Jul 2024

Artificial Intelligence Course

Artificial Intelligence

  • Components of AI
  • Categories of Machine Learning
  • Recurrent Neural Networks
  • Recurrent Neural Networks
Artificial Intelligence Course

Upcoming Class

6 days 29 Jun 2024

Machine Learning Course

Machine Learning

  • Introduction to Machine Learning & Python
  • Machine Learning: Supervised Learning
  • Machine Learning: Unsupervised Learning
Machine Learning Course

Upcoming Class

19 days 12 Jul 2024

 Tableau Course


  • Introduction to Tableau Desktop
  • Data Transformation Methods
  • Configuring tableau server
  • Integration with R & Hadoop
 Tableau Course

Upcoming Class

12 days 05 Jul 2024

Search Posts


Receive Latest Materials and Offers on Salesforce Course