Member Junction
    Preparing search index...

    Interface ActionFilterContext

    Execution context handed to an Action Filter's Code when the engine evaluates it inline (i.e. when no BaseActionFilter subclass is registered for the filter). The code runs with this object bound as ActionFilterContext and signals its verdict either by returning a boolean or by assigning ActionFilterContext.result.

    interface ActionFilterContext {
        change?: EntityChangeContext;
        filter: MJActionFilterEntity;
        NewValues: Readonly<Record<string, unknown>>;
        OldValues: Readonly<Record<string, unknown>>;
        params: RunActionParams;
        result: boolean;
        DidFieldChange(fieldName: string): boolean;
        DidFieldChangeToValue(fieldName: string, value: unknown): boolean;
    }
    Index

    Properties

    What changed about the record, when the run came from an entity lifecycle event.

    undefined for a run with no save behind it — a direct invocation, a View/List fan-out, an agent calling the action. Filter code must therefore treat absence as "I cannot tell", which the helpers below already do by returning false.

    The filter row being evaluated.

    NewValues: Readonly<Record<string, unknown>>

    Field values as they are now. Empty object when there is no change context.

    OldValues: Readonly<Record<string, unknown>>

    Field values as they were before the change. Empty object when there is no change context.

    The full parameters of the action run being gated, including Action, Params, and ContextUser.

    result: boolean

    Alternative verdict channel: filter code may assign true (allow) / false (prevent) here instead of returning.

    Methods

    • true when the named field's value actually differs across this save.

      Bound to the run's change context so filter code reads as the question it is asking: return ActionFilterContext.DidFieldChange('Status'). False on a create — a field that was never anything else did not change to what it is.

      Parameters

      • fieldName: string

      Returns boolean

    • true when the named field changed AND its new value equals value.

      The transition predicate — "when Status becomes Approved" — as opposed to the state predicate "when Status is Approved", which fires on every subsequent save too. Comparison is loose across the string boundary metadata forces, so '1', 1 and true compare equal.

      Parameters

      • fieldName: string
      • value: unknown

      Returns boolean