From b18d3602e536f6d0ba7183eafcb41d60cd234baa Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Sun, 23 Jun 2024 01:06:01 -0700 Subject: [PATCH] Add README --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..d6f493c --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +# Flowpex +Invoke Apex in Flows + +## Objective +The goal of Flowpex is straightforward: make as many Apex functions available in Flows as possible. This was initially inspired by the need to control Flow behavior based on the time zone of the running user; this is something that, at the time, required Apex to accomplish. + +## Design + +The library is a simple but large collection of [Invocable Methods](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_InvocableMethod.htm). Each one correlates to an Apex namespace, class, and function. + +For example, to get the time zone of the current user in a Flow, add an Apex Action node that calls `flowpex__System_UserInfo_getTimeZone` and pass the Flow global variable `$User` as an argument. + +## Installation + +A variety of packages are available. +1. Each namespaced Apex class is packaged separately so that features can be installed as needed. +1. Each Apex namespace is packaged as a whole so that all classes can be installed at once. + +## Caveats + +* Since Invocable Methods must be static, all methods included in Flowpex that normally operate on an instance of a class will instead accept it as a parameter. +* Due to the restrictions placed on inputs and outputs of Invocable Methods, not all arguments or return types are possible. + * This library includes some workarounds to allow certain data types that are otherwise inaccessible. + +### Example +Consider the `flowpex__System_SObject_getSObjectType` Apex Action in a Flow. +1. It will accept, as an argument, an instance of an sObject (i.e. an Account record). +1. It will return the custom Apex-defined data type `flowpex__Schema_SObjectType`. +1. The Apex-defined return type will consequently only consist of primitives, sObjects, and/or Apex-defined types. \ No newline at end of file -- 2.52.0