The ICustomerManagementPATCH interface supports extensibility for PATCH operations by allowing validation, transformation, and post-processing of update requests. Implementations can enforce business rules, adjust mutation payloads, and refine the resulting responses maintaining TMF-compliant behavior.
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
Note
Update Lifecycle Use Cases and Hook Mapping
The following table lists common use cases and hooks required for PATCH operation.
Use Case
Hook(s)
Description
Example Scenarios
Benefit
Enforce Status Transitions
applyCustomValidations
Validates requested status changes before updating the record to ensure transitions adhere to defined lifecycle rules, regulatory constraints, or business policies. Stops invalid or unauthorized state changes.
• Prevent transition from Inactive → Active without required approvals• Block changes to Suspended unless preconditions are met• Enforce linear lifecycle progression (e.g., Pending → Active, but not Closed → Active)
Prevents invalid or noncompliant state transitions and preserves data integrity
Maintain Audit Trail
customiseMutationPayload
Automatically enriches the update payload with audit metadata before persistence. Ensures all modifications are traceable and compliant with auditing standards.
• Add “modifiedBy” and timestamp fields• Track system-initiated vs. user-initiated changes• Add audit IDs for downstream monitoring systems
Provides a complete and reliable audit trail for internal governance and external compliance needs
Validate Data Format
applyCustomValidations
Ensures updated data—such as contact details, identifiers, or structured fields—meets required formatting rules before the update is processed. Prevents malformed or inconsistent data from entering the system.
• Validate phone number format• Confirm email structure and domain correctness• Ensure address fields follow standardized formats
Improves data quality, prevents inconsistencies, and enhances downstream system reliability
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 updating a customer record. Use this to add computed fields, transform values, or apply business logic transformations.
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 updated.