ICustomerManagementDELETE Apex Interface
The ICustomerManagementDELETE 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.
These hook are not used for the Customer Management API. If implemented, the method may be invoked, but its return values are ignored.
configureDefaultValidationscustomiseGraphQLQuery
This table lists common use cases and the hooks required for the DELETE operation.
| Use Case | Hook(s) | Description | Example Scenarios | Benefit |
|---|---|---|---|---|
| Enforce Deletion Rules | applyCustomValidations | Validates whether a record is eligible for deletion by checking dependencies, business constraints, and user permissions. Prevents unsafe deletions that may violate data integrity or operational rules. | • Block deletion if active child records exist• Enforce that only admins can delete high-value accounts• Prevent deletion when linked to open cases or agreements | Prevents accidental deletion of critical records and preserves data integrity |
| Maintain Audit Trail | customiseMutationPayload, handlePostOperation | Enriches the deletion request with audit metadata and records post-delete events, enabling traceability for compliance and regulatory review. Supports soft-delete or archival strategies. | • Capture who deleted the record and timestamp• Add soft-delete flags before actual deletion• Trigger audit-event logging after deletion | Provides a complete audit trail for compliance and monitoring |
| Support External Identifiers | resolveUniqueIdentifiers | Allows records to be deleted using external IDs instead of Salesforce IDs. Enables seamless integration with external or legacy customer systems. | • Delete by external CRM customer ID• Resolve telecom subscriber ID to internal account before deletion• Accept partner-system identifier for record lookup | Enables interoperability with external platforms and simplifies integrations |
| Clean Up Related Data | handlePostOperation | Performs cascading cleanup of related or dependent data after a record has been deleted. Ensures the system remains consistent and free of orphaned or stale records. | • Archive or remove associated contact mediums• Delete orphaned child records after parent deletion• Trigger asynchronous cleanup workflow for related data | Maintains data consistency and avoids accumulation of stale or orphaned records |
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)
This hook validates custom business logic before deleting customer record. If validation fails, rejects the request and returns an error response.
The handler processes return values as follows.
Success:
- Return a map with validationStatus set to any value other than "fail" (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)
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)
This hook post-processes and transforms the API response after data is deleted.
Map<String, Object> handlePostOperation(Map<String, Object> graphQLQueryResultAsMap, Map<String, Object> constructedTMFResponse, Map<String, Object> context)
Here's a complete sample Apex implementation using all supported hooks.
Delete mutations remove records. The delete transformation supports inserting GraphQL snippets to perform related operations, such as unlinking relationships before deletion or creating audit logs.
The insertGraphQlSnippet instruction allows you to embed complete GraphQL operations within a mutation and serves as the primary mechanism for extending delete operations.
Transformation Instructions (JSON):
Result (GraphQL):