In a world where developers battle the relentless forces of boilerplate code, a new hero has emerged from the depths of Apex! Get ready to embark on an epic journey as we unveil Universal Invocable, the groundbreaking feature that's about to change the game in Salesforce Flow development!
🌟 Cue dramatic music 🌟
Introducing Universal Invocable[1], the elegant solution that lets developers expose multiple Apex methods to flows without drowning in a sea of tiny, one-method classes. Say goodbye to the days of writing one-class-per-invocable-method. Universal Invocable is here to save the day!
But hold onto your developer hats, because harnessing the power of Universal Invocable does require a (teensy) bit of effort. You'll need to extend your classes with the provided UFInvocable
class, masterfully patterned after Salesforce's own Callable
Interface. Don't worry; this hero class is fully bulkified, enabling your flows to call multiple Apex methods from the same Action element!
🚀 Explosions in the background 🚀
But that's not all! Universal Invocable comes equipped with the incredible UniversalInvocable
Invocable Action. This action is your trusty sidekick, capable of calling any Apex method from classes that extend the UFInvocable
class. Together they're an unstoppable duo, ready to conquer any development challenge in their path!
🌠 Epic montage of developers coding 🌠
To get started on your own heroic journey with Universal Invocable, head over to the source code. For some light, and totally not dry, reading on the Callable
Interface, UFInvocable's
soul sister, consult the Callable Interface documentation.
🚨Shut up and take my money! 🚨
For now, the installation instructions are simple: manually copy the Universal Invocable classes from the source link into your org. Be sure to snag the example Flow to get a sense of how to invoke this from Flow! (this is not a paid product. It’s open source, and freely available here.)
🔥 TL;DR; 🔥
Who is this for? Salesforce Developers who want to expose Apex methods to Flow without littering their org with a ton of Single-method classes.
What does this do? Establishes a ‘universal’ way of invoking almost any Apex code from your org through a single InvocableAction.
Seriously? Hell yes. You just need to extend the provided UFInvocable
class and create the call()
method.
What doesn’t it do? Slice, dice, and roast chickens work automagically without you having to do anything. You, a Salesforce developer, will need to add a small bit of Apex to the classes you want to expose, but this should be less work than generating a one-off, single-method @invocableMethod
classes.
💳 Who made this? 💳
Listen, y’all. Back in August, I was laid off. I’ve been putting some of my (f)unemployed time into documenting and building on my pet project - ApexKit. I had the idea for Universal Invocable and put together a prototype using the Callable
interface. I asked Brian Fear - better known as sfdcfox - to give me a code review, and not only did he fix my stupid dyslexic typos, but he also hit upon and implemented the bulkification that enables you to call multiple Apex methods from the same action block. In short, he took my Awesome idea (™) and made it positively Epic. If you’ve not heard, Brian is also (f)unemployed at the moment. If you like Universal Invocable, please consider throwing some love our way.
If you feel so moved, please do boost this post, and here’s our relevant information:
Brian Fear, aka SfdcFox
Paypal: brian.m.fear@gmail.com
Venmo: brianmfear
Buy Me A Coffee: brianmfear
Zelle: brianmfear@gmail.com
Cash App: $BrianFear
Kevin Poorman, aka Codefriar
Paypal: kjp@codefriar.com
Venmo: Kevin-Poorman
Buy Me A Coffee: Codefriar
[1]: Look, naming things is hard. I wanted to name this Project Hulk. (Because Hulk is easily the best Avenger. After all, he’s had a traumatic accident that granted him superpowers that he’s only able to access while he’s struggling with the worst aspects of himself, and he’s still attempting to do good for the rest of the world.) But well, Marvel said no. ¯\(ツ)/¯