TRIGGER_FLIPPER
Description
This function is used within a before insert or before update trigger to track whether a specific checkbox field (defaulting to FALSE) has been flipped from FALSE to TRUE. The "flipped" state is recorded in memory only.
Immediately after tracking the flip, the function resets the checkbox field to FALSE, ensuring that the field remains unchecked in the database. This mechanism allows users to manually trigger actions by checking the field on demand—without persisting the change.
If the optional parameter flip_if_evaluated_true_optional is provided and evaluates to TRUE, the function will also treat the field as flipped. This allows you to define automatic rules that simulate a flip and trigger corresponding logic.
Syntax
TRIGGER_FLIPPER(flip_if_evaluated_true_optional) -> Boolean
Parameters
| Parameter | Data Type | Required | Description |
|---|---|---|---|
| flip_if_evaluated_true_optional | Boolean | No | Flips the field if this evaluates to true; otherwise, no flip occurs. |
Examples
TRIGGER_FLIPPER()
-- Returns TRUE the first time it's called in a flow, then FALSE for the rest.TRIGGER_FLIPPER(Priority == "High")
-- Returns TRUE again whenever the Priority equals "High".Tips
Typically used with the TRIGGER_IS_FLIPPED function which can be called later in the same transaction to determine whether the field was flipped and execute related actions accordingly.