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.
These hooks are not used for the Customer Management API. If implemented, the method may be invoked, but its return values are ignored.
configureDefaultValidations
customiseGraphQLQuery
Note
Creation Lifecycle Use Cases and Hook Mapping
The following table lists common use cases for POST operation.
Use Case
Hook(s)
Description
Example Scenarios
Benefit
Enforce Business Rules
applyCustomValidations
Validates 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 Fields
customiseMutationPayload
Automatically 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 codes
Reduces manual data entry, enforces consistency, and improves data accuracy
Audit Trail
handlePostOperation
Adds 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 services
Maintains a reliable and compliant audit trail across all customer creation events
transformRequest
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.
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.
1/**2 * Customizes the mutation payload before the GraphQL mutation is executed.3 * Reads Description and Industry from the request body in context and adds them4 * to the Account node at alias path "customerAccount".5 *6 * @param request The mutation request payload7 * @param context Request context containing API details and request body8 * @return Map containing mutation transformation instructions with nodes array:9 * - nodes[0]: Contains path='customerAccount' and addFields with Description and Industry10 */11 public Map<String, Object> customiseMutationPayload(Map<String, Object> request, Map<String, Object> context) {12 // Return mutation transformation instructions: add Account fields at alias path "customerAccount"13 Map<String, Object> nodes0 = new Map<String, Object>();14 nodes0.put('path', 'customerAccount');15 Map<String, Object> addFields = new Map<String, Object>();1617 // Read Description and Industry from request body in context18 Map<String, Object> requestBody = (Map<String, Object>)context.get('requestBody');19 if (requestBody != null) {20 String description = (String)requestBody.get('description');21 String industry = (String)requestBody.get('industry');2223 // Add Description to Account if present in request24 if (description != null) {25 addFields.put('Description', description);26 }27 // Add Industry to Account if present in request28 if (industry != null) {29 addFields.put('Industry', industry);30 }31 }3233 nodes0.put('addFields', addFields);3435 // Build nodes array containing the transformation instructions36 List<Object> nodes = new List<Object>();37 nodes.add(nodes0);3839 // Return result with nodes array40 Map<String, Object> result = new Map<String, Object>();41 result.put('nodes', nodes);42 return result;43 }
handlePostOperation
This hook post-processes and transforms the API response after data is deleted.
1mutation CreateCustomerAndRelatedEntities {2 uiapi {3 customerAccount: AccountCreate(input: {4 Account: {5 Name: "Acme Corp",6 Industry: "Technology",7 Status: "Active"8 }9 }) {10 Record {11 Id12 Name { value }13 }14 }15 }16}
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.
Note
Create Enhancements: Modify Existing Input Fields
Original Mutation (GraphQL):
1mutation CreateCustomerAndRelatedEntities {2 uiapi {3 customerAccount: AccountCreate(input: {4 Account: { Name: "Acme Corp" }5 }) {6 Record {7 Id8 Name { value }9 }10 }11 }12}
1mutation CreateCustomerAndRelatedEntities {2 uiapi {3 customerAccount: AccountCreate(input: {4 Account: { Name: "Updated Company Name" }5 }) {6 Record {7 Id8 Name { value }9 }10 }11 }12}
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.