The Begin New Monitor component initializes a new SightLane monitor. It is used when we want to control the creation of a new Event and sequence its auditing data. Though this component is used less often than you'd think, it can be critical to creating robust logging.
When to use the Begin New Monitor Component
In most situations, designers want to minimize the number of database calls made in a process. So, they collect a set of logging statements during the Flow and report them all at the end, using the ReportEventToSightLane or ReportEventFailureToSightLane components.
However, if a flow calls InvocableMethods (aka Apex classes) and those Apex classes add logs to the "current monitor," there is a risk of the Apex logs remaining unrecorded. This is because they are logged to the "current monitor" before an Event is actually created (Read more about the current monitor).
To properly support a mix of Flow and Apex visibility, we sometimes need to explicitly begin an Event so that any "current monitor" logging that occurs during the Event will be properly recorded.
Step 1: Add the component
To begin, add the Begin New Monitor event to your Flow. Ensure that it occurs in the Flow before any Action components that might add Logging to the current Flow audit.
There are three properties available to set up and distinguish the Begin New Monitor Event.
Event Id - This is a unique value that identifies this individual Event occurrence. It is common (but not required) to use the Flow's InterviewGuid for this value. Unlike in other components, the Event Id is a required field.
SightLane Monitor Name - This is how you name the monitor under which this Event will be saved. It is possible to save documentation from multiple Flows under the same Monitor. A common practice is to name the monitor after the Flow for which it creates visibility, but this is not required.
Primary Record Id - Allows monitors to "associate" an Event with a particular data record. If there is an issue during an Opportunity update, it sure would be nice to know which one! In addition, this will enable seamless navigation between the Event log and the affected record, making research and review much faster.
Step 2: Connect to the Reporting Components
Now that the component has been set up, it's critical to connect it properly to the ReportEventToSightLane or ReportEventFailureToSightLane components. The Event Id for this component and the Event Id for any reporting components must match. This is how the reporting component will know to close this Event rather than creating an entirely separate one.
Summary
Though the Begin New Monitor Event component is not used as often as other SightLane Flow Auditing components, it plays an important role in ensuring that auditing data is complete and sequenced properly, giving developers and users the best possible insights into their business processes.
Comments
Article is closed for comments.