Last Updated on January 21, 2022

About Process Builder

As we know it’s a point and click tool to setup immediate and time-based action. Its powerful design lets you build and customize the automated process.

Helpful In:

  • 1. Send an Email
  • 2. Call another process
  • 3. Post to chatter
  • 4. Submit for Approval
  • 5. Update/Create records
  • 6. Quick Actions

Also Read: How to Create a Salesforce Lightning Map Component?

Can’t Do:

  • 1. Delete a Record
  • 2. Outbound Message

But you don’t have to worry about this because you can get these jobs done by adding customized functionality to your Salesforce process by calling an Apex call. In this blog, we will learn about calling an Apex code in Process Builder.

Points to Consider

Write your code in your Apex class as a usual class but make sure that you have considered the below points:

  • 1. Only Classes that have @InvocableMethod annotation will be listed for selection. Use this annotation at the method level.
  • 2. The method should be static and public or global.
  • 3. A class can only have one method which has this annotation.
  • 4. Can’t use other annotations with @InvocableMethod annotation.

Call Apex Class in Process Builder

Business Use Case

Consider a scenario where we want to call an apex callout for fetching a zipcode while account update basis on Billing state and city.

In order to achieve this, we will create a process builder and write an apex class. Our class looks like.
Public class zipcodeUpdate{
@InvocableMethod
Public static void invokeapex (list acc){
Futureapex.apexcallout(acc[0].billingstate,acc[0].billingcity,acc[0].id);
}
}

Here Future apex is another class in order to make a callout to other service to fetch zipcode basis on billing city and state.

Searching for a reliable salesforce consulting company?  Our experienced salesforce developers can provide you custom salesforce solutions for your next Salesforce project.

Also Read: How To Connect Pipedrive and Salesforce Integration

Author Bio:

With a decade of experience in eCommerce technologies and CRM solutions, Virendra has been assisting businesses across the globe to harness the capabilities of information technology by developing, maintaining, and improving clients’ IT infra structure and applications. A leader in his own rights his teammates see him as an avid researcher and a tech evangelist. To know how the team Virendra can assist your business to adopt modern technologies to simplify business process and enhance productivity. Let’s Talk.

Avatar photo
Author

With a decade of experience in eCommerce technologies and CRM solutions, Virendra has been assisting businesses across the globe to harness the capabilities of information technology by developing, maintaining, and improving clients’ IT infrastructure and applications. A leader in his own rights his teammates see him as an avid researcher and a tech evangelist. To know how the team Virendra can assist your business to adopt modern technologies to simplify business processes and enhance productivity. Let’s Talk.

whatsapp