Tech blog to share information.

May 7, 2018

Salesforce : Making Callouts to External System via Process builder

May 07, 2018 Posted by tj cool , , No comments


To invoke apex callouts from Process builder we need to follow below steps


  • Create Apex class having a method with annotation @InvocableMethod. The class can only contain single @InvocableMethod method.
  • Currently, Salesforce does not support callout to external systems directly. To do so, we will need @Future callout. Future methods have annotation @future(Callout=true).
Please check class snapshot for reference.

 

Creating Process Builder Flow


  1. Navigate to Process Builder 


  1. Specify the Object and when to start the process setting. I am working on Case.


  1. Define Criteria for our action defined.


  1. Define the action, here is action comprises of calling the Apex method annotated with @InvocableMethod.
    1. Action Type: As we need to call apex class so selected Apex.
    2. Action Name: Friendly name to identify actions.
    3. Apex Class: Class that needs to invoke.
    4. Apex Variable: If you want to pass information to invoking method you can pass parameters. In this case, I am passing the ID of the newly created case to my methods.
Apex variable is visible only if @InvocableMethod accepts parameters.  Below is my method signature.



  1. If You want to create multiple actions, then repeat Step-4.

  1. If all needed conditions are configured. Then click on Save.


  1. Don’t forget to Click on Activate.



Complete Class Snapshot :


Please do comment and Subscribe

0 comments: