How to Call an Invocable Method from Flow Wrapper

  • By:BAOPACK
  • 05-05-2024
  • 166

Step-by-Step Guide: How to Call an Invocable Method from Flow Wrapper

Flow is a powerful tool in Salesforce that enables you to automate your business processes. One essential feature of Flow is the ability to call invocable methods, which can further extend the functionality and flexibility of your automation.

What is an Invocable Method?

An invocable method is essentially a custom Apex method decorated with the @InvocableMethod annotation. This annotation allows the method to be called from a Flow action. By invoking this method, you can execute custom logic, perform complex calculations, or interact with external systems within your Flow.

Calling an Invocable Method from a Flow Wrapper

1. Create your invocable method in Salesforce Apex with the @InvocableMethod annotation.

2. Build your Flow in Salesforce Setup by dragging and dropping elements onto the canvas.

3. Add a ‘Apex’ record in your Flow and select the invocable method you created.

4. Map input and output parameters between your Flow and the invocable method.

5. Run the Flow, and the invocable method will be triggered with the specified inputs and return any outputs back to the Flow.

Example Scenario

Let’s consider a scenario where you have a Flow that needs to calculate a discount based on certain criteria. By calling an invocable method, you can perform the discount calculation within Apex code, keeping your Flow streamlined and efficient.

Benefits of Using Invocable Methods

– Reusable code: Once you create an invocable method, you can call it from multiple Flows, promoting code reusability.

– Complex logic: Invocable methods allow you to execute intricate logic that might be challenging to implement directly in a Flow.

– Integration capabilities: You can leverage invocable methods to integrate Salesforce with external systems or APIs.

Conclusion

Calling an invocable method from a Flow wrapper opens up a world of possibilities for automating your business processes in Salesforce. By following the steps outlined in this guide, you can effectively harness the power of invocable methods to enhance the functionality and efficiency of your Flows.



vr

+VR TOUR

INQUIRY

    Online Service