IAccountManagementDELETE Apex Interface

The IAccountManagementDELETE interface provides extensibility for DELETE operations through Apex-based validations, mutation-payload adjustments, and post-operation processing. Users can enforce deletion policies, apply soft-delete or metadata logic, and customize final responses without impacting TMF-compliant delete behavior.

This interface supports the following hooks.

The customiseGraphQLQuery is not applicable to DELETE, which is a write operation, so there is no read query to customize. This hook is declared on the read interface (ICommsGET), not on ICommsDELETE. To customize the soft-delete mutation payload, use customiseMutationPayload.

Use CaseHook(s)DescriptionExample ScenariosBenefit
Resolve an External Key to the Salesforce IDtransformRequestResolves a caller-provided business key or external identifier to the canonical Salesforce Account ID before validation and deletion processing begins.- Resolve an ERP customer number
- Map a billing-system identifier to an Account ID
- Translate a partner-specific key
- Resolve a legacy account reference
Allows callers to address Account records using their own identifiers instead of requiring a Salesforce ID.
Block Deletion Based on Business PreconditionsapplyCustomValidationsEvaluates business rules and dependent-record conditions before the delete mutation is built. The operation is rejected when the Account does not satisfy the required deletion criteria.- Prevent deletion when active subscriptions exist
- Block deletion when the Account has an open balance
- Reject deletion when active contracts or orders exist
- Protect Accounts involved in unresolved disputes
Prevents invalid deletion or deactivation of Accounts that still have active financial, contractual, or operational obligations.
Capture a Deactivation Reason or Audit FieldcustomiseMutationPayload (addFields)Adds organization-specific fields to the mutation payload without replacing the standard delete input. These fields can capture the reason, actor, source, or timestamp associated with the deactivation.- Store a deactivation reason code
- Record the user who initiated the operation
- Add a deactivation timestamp
- Capture the originating channel or system
Records why and how the Account was deactivated, improving traceability and operational reporting.
Override the Terminal StatuscustomiseMutationPayload (modifyInput)Modifies the standard mutation input to use an organization-specific terminal status instead of the default soft-delete status.- Set the status to Cancelled
- Use Closed for completed Account relationships
- Apply a region-specific terminal state
- Select a status based on Account type
Aligns soft-delete behavior with organization-specific lifecycle models by using Cancelled, Closed, or another terminal status instead of Inactive.
Cascade Cleanup or DeprovisioninghandlePostOperationRuns after the Account mutation completes and uses the operation result to clean up related resources or initiate downstream deprovisioning.- Deactivate Account-contact junctions
- Revoke associated entitlements
- Disable downstream access or services
- Publish a deprovisioning event
- Notify billing or subscription systems
Keeps related records and downstream systems consistent with the Account’s deactivated state.
Create an Audit TrailhandlePostOperationRecords the completed deletion or deactivation in an audit or compliance system after the mutation succeeds.- Write a compliance audit entry
- Record the actor, timestamp, and affected Account
- Store the mutation result and deactivation reason
- Publish an immutable deletion event
Provides a reliable compliance record of Account deletions and deactivations.

This hook transforms the request context before processing any operation. It is invoked early in the request lifecycle, allowing implementers to adjust the context for subsequent extensibility hooks.

Map<String, Object> transformRequest(Map<String, Object> context)

Resolve an external ID to a Salesforce Contact ID.

This hook validates custom business logic before retrieving customer record. If validation fails, it rejects the request and returns an error response.

The handler processes return values as follows.

Success:

  • Return a map with validationStatus set to “pass” (case-insensitive).
  • The API request continues normally.
  • Other fields in the map are logged but not used.

Failure:

  • Return a map with validationStatus set to “fail” (case-insensitive).
  • The API request is terminated immediately.
  • Raise a ValidationException containing
    • message: value from validationMessage key (or “Validation failed” by default)
    • details: value from validationDetails key (optional)
  • The client receives an HTTP 400 error response.

Map<String, Object> applyCustomValidations(Map<String, Object> context)

Block deletion when the Account has active subscriptions.

This hook modifies the mutation payload before deleting a customer record. Use this to add deletion metadata, set soft-delete flags, or apply business logic transformations.

Map<String, Object> customiseMutationPayload(Map<String, Object> request, Map<String, Object> context)

Add a custom field alongside the Status = Inactive change so the soft delete captures why the account was deactivated.

This hook post-processes and transforms the API response after data retrieval.

Map<String, Object> handlePostOperation(Map<String, Object> graphQLQueryResultAsMap, Map<String, Object> constructedTMFResponse, Map<String, Object> context)

Audit-log the soft delete and cascade cleanup.

Here’s a complete sample Apex implementation using all supported hooks.