Flows

Flows are a powerful low-code automation tool, and one that is often overlooked by logging frameworks. Let's take a look at how to incorporate Pharos Triton logging into your declarative powerhouse.

Invocable Methods

Once of the big advantages to using Flows is the ability to utilize Apex code. This technique really opens up a whole world of possibilities. We won't spend too much time here describing the intricacies if Invocable Apex. For more information on what these are all about please refer to the Salesforce documentation.

Triton Invocable

In order to save a log record from Flow you can utilize the TritonFlow.log() invocable method. Similar to many of its Apex counterparts, this method takes in an Instance of a FlowLog class, which is composed of the key enums such as Category, Type and Area, as well as the Summary and Details, and any additional fields you may wish to pass along to the Log.

Once new parameter you may have noticed is the Interview GUID. This parameter represents an id of the currently running Flow instance. We recommend that you always pass this value along by using $Flow.InterviewGuid global variable. This will allow Pharos Triton to link up Flow failures to your customs logs. More details on this can be found in the next section.

Passing Additional Fields

Should you need to set specific fields on the Log record via Flow, Pharos Triton provides a "catch all" capability to do so. The Additional Fields parameter takes in a JSON map of field names and values. To produce this map via Flow we recommend utilizing the Text Template resource.

The structure of this Template should be a well-formed JSON object with keys denoting field names and values set as you see fit. You are also free to utilize merge fields for values.

Note that it's best to utilize Plain Text view here since rich text formatting is completely irrelevant in this context.

Expanding Invocable Methods

If you find yourself in a situation where you're passing the same parameters to your Flow logs, we recommend expanding the FlowLog class by adding the necessary attributes. This approach will save you time over passing a custom JSON template.

Permissions

If you wish to utilize this technique for Flows it is important that you grant all users access to the FlowLog class. Salesforce requires that all invocable methods be accessible. It may be more convenient to create a Permission Set for easy assignment to users.

Last updated