# IF_Trigger.PostAction

**Class** · Group: `Triggers`

Learn it: [Fast Start - Trigger Actions](/fast-start-trigger-actions) and [Triggers guide](/triggers-guide)

<div class="apex-member apex-class">

```apex
global interface IF_Trigger.PostAction
```

Handler contract for a post-trigger action — an Apex class that runs exactly once at the end of a trigger transaction, after every trigger action on every touched SObject has completed. Use for cross-object or transaction-scoped work that cannot be done from inside an individual trigger action: audit aggregation, asynchronous job enqueue, transaction-wide telemetry. DML is contractually prohibited — the framework throws if a post-trigger action performs DML, regardless of the row's FailureAction setting. Registered via PostTriggerAction__mdt. The framework fires post-actions at the outermost dispatch unwind, in Order__c ascending. Optional gates apply in order: BypassExecution → BypassFeatureFlag / RequiredFeatureFlag → TriggerSetting scope → EntryCriteriaContextClassName.

</div>

---

## Methods

| Method | Description |
|--------|-------------|
| global abstract void [execute](#execute)([IF_Trigger.PostActionContext](/reference/apex/if-trigger-postactioncontext) context) | Called once per outermost dispatch with the context of touched SObject types. |

### execute

<div class="apex-member">

```apex
global abstract void execute(IF_Trigger.PostActionContext context)
```

Called once per outermost dispatch with the context of touched
SObject types. Implementations should be idempotent within a single transaction —
a transaction with N top-level DML statements fires post-actions N times.

**Parameters**

| Parameter | Type | Description |
|-----------|------|-------------|
| `context` | [IF_Trigger.PostActionContext](/reference/apex/if-trigger-postactioncontext) | The post-action context for this dispatch. Carries the set of SObject types whose triggers participated in the transaction. |

**Example**

```apex
public class TRG_EmitTransactionAudit implements IF_Trigger.PostAction
{
    public void execute(IF_Trigger.PostActionContext context)
    {
        if(context.touchedSObjectTypes.isEmpty()) return;
        LOG_Builder.build()
            .info('Transaction touched ' + context.touchedSObjectTypes.size() + ' SObject(s)')
            .emitAt('TRG_EmitTransactionAudit');
    }
}
```

</div>
