The IIndividualPartyManagementGET Apex interface provides extensibility for GET operations through Apex pre- and post-hooks and GraphQL query customization. Implementations can validate incoming requests, modify query structures, and refine the response to support business-specific retrieval rules while maintaining TMF-compliant behavior.
This table lists common use cases and the hooks required for the GET operation.
Use Case
Hook(s)
Description
Example Scenarios
Benefit
External-ID Resolution
transformRequest
Transforms legacy, external, or customer-specific identifiers into the canonical request format expected by the API. This allows existing clients to continue using familiar identifiers while keeping the underlying service contract consistent.
- Resolve a legacy customer key to { id } - Translate an account number into an internal resource ID - Normalize identifiers received from partner or migration systems
Preserves backward compatibility and simplifies integration with legacy or external systems.
Role-Based and Regional Access Control
applyCustomValidations
Applies authorization and data-governance rules before executing an operation. Access can be evaluated using the user’s role, region, business unit, channel, or request context.
- Restrict access to customers outside the user’s assigned region - Permit only supervisors to access high-value customer records - Block partner channels from retrieving internal-only resources
Strengthens data governance and ensures secure, policy-compliant access across users and regions.
Configurable Validation Policies
configureDefaultValidations
Enables, disables, or adjusts standard validation flags according to organization-specific requirements. Validation behavior can be tightened or relaxed without changing the core API implementation.
- Require additional identifier validation for regulated organizations - Disable a non-applicable validation for trusted internal channels - Enable stricter checks in production while relaxing them in test environments
Provides flexible validation behavior while preserving a reusable and consistent API foundation.
Dynamic Query Customization
customiseGraphQLQuery
Modifies GraphQL queries before execution by adding fields, filters, relationships, or server-side constraints. Query behavior can be tailored to the client, organization, or request context without changing the base schema.
- Add organization-specific custom fields - Automatically apply regional or tenant filters - Include entitlement, hierarchy, or relationship data for portal clients - Request a reduced field set for mobile applications
Supports richer, client-specific data requirements while reducing schema changes and API version proliferation.
Response Enrichment
handlePostOperation
Processes successful operation results before returning them to the client. It can add derived fields, attach audit metadata, transform values, or combine the response with information from internal or external sources.
- Add a calculated customer health score - Include audit timestamps or processing metadata - Flag preferred or high-risk customers - Add aggregated financial, service, or usage insights
Delivers richer and more contextual responses while preserving the integrity of the underlying API schema.
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.
Resolve an external ID to a Salesforce Contact ID.
1global class IndividualGetTransformRequestExt implements comms_apex_ext.IIndividualPartyManagementGET {234 global static Map<String, Object> transformRequest(Map<String, Object> context) {5 if (context == null) {6 return context;7 }8910 Object idObj = context.get('id');11 if (!(idObj instanceof String)) {12 return context;13 }14 String idValue = (String) idObj;151617 // A 15- or 18-character value already looks like a Salesforce Id; leave it as-is.18 if (idValue.length() == 15 || idValue.length() == 18) {19 return context;20 }212223 // Otherwise treat it as an external key and resolve it to a Contact Id.24 List<Contact> contacts = [25 SELECT Id FROM Contact WHERE External_Id__c = :idValue LIMIT 126 ];27 if (!contacts.isEmpty()) {28 context.put('id', contacts[0].Id);29 }30 return context;31 }323334 // ... other hooks return null / empty map ...35}
configureDefaultValidations
This hook enables, disables, or modifies the built-in validation rules before they execute.
Add a custom flag consumed by applyCustomValidations.
1global class IndividualGetConfigValidationsExt implements comms_apex_ext.IIndividualPartyManagementGET {234 global static Map<String, Boolean> configureDefaultValidations(5 Map<String, Boolean> defaultValidationConfiguration,6 Map<String, Object> context7 ) {8 Map<String, Boolean> overrides = defaultValidationConfiguration != null9 ? defaultValidationConfiguration.clone()10 : new Map<String, Boolean>();11 overrides.put('regionAccessCheck', true); // your own flag, read in applyCustomValidations12 return overrides;13 }141516 // ... other hooks return null / empty map ...17}
applyCustomValidations
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)
Query transformations provide the ability to enhance GraphQL queries by adding fields, applying filters, or modifying the sort order, while preserving the original query definition.