ICustomerManagementPOST Apex Interface

The ICustomerManagementPOST interface enables customization of POST operations using Apex lifecycle hooks. Implementations can validate and enrich creation payloads, apply additional business logic, and modify the final response structure, ensuring that customer-creation workflows remain flexible maintaining TMF-compliant 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.

  • configureDefaultValidations
  • customiseGraphQLQuery

The following table lists common use cases for POST operation.

Use CaseHook(s)Description
Example Scenarios
Benefit
Enforce Business RulesapplyCustomValidationsValidates customer creation requests before processing to ensure they comply with business rules, data quality constraints, and organizational policies. Prevents invalid or duplicate customer records from entering the system.• Block creation of customers with duplicate names or identifiers• Reject requests with invalid customer types or lifecycle statuses• Enforce mandatory business validations (e.g., email/phone standards)Prevents invalid or low-quality customer records from being created, improving data integrity
Auto-Populate FieldscustomiseMutationPayloadAutomatically enriches or computes field values during customer creation. Ensures consistent and accurate population of derived or dependent fields before data is persisted.• Generate customer display name from first/last name• Auto-calculate classification, segment, or service level• Populate geo-encoding or internal routing codesReduces manual data entry, enforces consistency, and improves data accuracy
Audit TrailhandlePostOperationAdds audit metadata to newly created customer records after persistence, ensuring every creation event is traceable for security and compliance.• Stamp “createdBy”, “createdAt” values• Add system identifiers for correlation or traceability• Trigger downstream audit logging servicesMaintains a reliable and compliant audit trail across all customer creation events

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 creating a 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 creating a customer record. Use this to add computed fields, set defaults, or transform the payload based on business logic.

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)

Create mutations add new records and return the created record with the specified output fields.

Original Mutation (GraphQL):

Transformation Instructions (JSON):

Result (GraphQL):

Original Mutation (GraphQL):

Transformation Instructions (JSON - Modify Input):

Result (GraphQL):

Using modifyInput with addInputFields adds new fields to the input payload. These fields are added to the Account object within the input wrapper and are sent to the mutation.

Original Mutation (GraphQL):

Transformation Instructions (JSON - Modify Existing Fields):

Result (GraphQL):

The inputModifications replaces the values of existing input fields. The transformer identifies the wrapper key, for example Account and applies the changes at the correct nested level.