IIndividualPartyManagementGET Apex Interface
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 interface supports the following hooks.
- transformRequest
- configureDefaultValidations
- applyCustomValidations
- customiseGraphQLQuery
- handlePostOperation
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. |
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)
Resolve an external ID to a Salesforce Contact ID.
This hook enables, disables, or modifies the built-in validation rules before they execute.
Map<String, Boolean> configureDefaultValidations(Map<String, Boolean> defaultValidationConfiguration, Map<String, Object> context)
Add a custom flag consumed by 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)
- The client receives an HTTP 400 error response.
Map<String, Object> applyCustomValidations(Map<String, Object> context)
Role-based/regional access control.
This hook modifies the GraphQL query before execution to add fields, filters, or transformations.
Map<String, Object> customiseGraphQLQuery(Map<String, Object> graphQLAsMap, Map<String, Object> context)
Add custom fields and a filter: For Individual GET, target the individualDataalias, which represents the Contact node.
This hook post-processes and transforms the API response after data retrieval.
Map<String, Object> handlePostOperation(Map<String, Object> graphQLQueryResultAsMap, Map<String, Object> constructedTMFResponse, Map<String, Object> context)
Enrich the response in place.
Here’s a complete sample Apex implementation using all supported hooks.
Default (without pageInfo) — a bare JSON array of Individual objects:
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.
Original Query (GraphQL):
Transformation Instructions (JSON):
Result (GraphQL):
Original Query (GraphQL):
Transformation Instructions (JSON):
Result (GraphQL):
Original Query (GraphQL):
Transformation Instructions (JSON):
Result (GraphQL):
Original Query (GraphQL):
Transformation Instructions (JSON):
Result (GraphQL):