I'm in a situation where I have a Screen flow that is called when an action button is clicked on an opportunity, some data is input, and then that data is pulled into an Apex class.

I understand that a Screen flow can't be called from an Apex class (although I wish that would be changed) but is it at all possible to call an Apex class from a screen flow? The issue is that there is specific information that needs to be pulled in from the user first before the class is called, and I'm trying to figure out a way to do this without building out a fully custom visualforce page.

Currently, this is the process I'm hoping to achieve:

  1. User/Sales Rep clicks 'Void Contract' action on the Opp.
  2. User is taken to a screen flow where they enter the type of void they want to perform (SelectedVoidType), and a new total value for a sales rep's commission (newQR).
  3. My apex class is called after the screen flow finishes that receives those 2 new variables, and updates some records and some other miscellaneous actions from there.

Is this process possible with what I'm looking to do? (i.e. screen flow --> apex class) If so, I would love some clarification/guidance on how I can proceed with it. Thank you!

1 Answer 1


Calling Apex from a screen flow is easy to achieve. You simply have to make sure you can call the code via an @InvocableMethod. The approach I take is to have the invocable method in a separate class (what I call a "facade") that then invokes the required logic on my underlying class. This has a couple of benefits:

  1. You can adapt the input parameters to be more logically structured and
  2. You can have a number of different logic methods in one class that are related and that can themselves be invoked from flows etc. - any given class can only have one invocable method, so you simply have multiple facade classes that are used in the flows.

Parameters to (and outputs from) invocable methods are a bit messy, but you can do this using the related @InvocableVariable mechanism. Just make sure you remember these always take lists due to the way flows invoke methods.

Note that the invocation of the method is part of the screen flow, rather than after it. You can have the flow receive back data and then do different things, perhaps showing messages or even going and invoking different processing that might include additional screens in the flow.

  • Thanks for the response @Phil W. Ok as a follow up, the new Flow Builder has no Call Apex action (at least, not one I can find...), however I thought it did. Originally, that's what I intended to do, but since I couldn't find that option I thought it wasn't available or possible in a Screen flow/Flow builder now. Any insight on what I could do from there? Nov 18, 2019 at 16:32
  • I assure you that it does... if you have already implemented invocable methods and deployed/installed them on the org and you have appropriate permissions for using the flow editor. The specific interaction you need is Action, then from that Apex Action. Most easily found under "filter by type".
    – Phil W
    Nov 18, 2019 at 16:40
  • Wonderful, thanks for the help @Phil W! Nov 18, 2019 at 16:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .