IOrganizationPartyManagementGET Apex Interface
The IOrganizationPartyManagementGET 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
| Use Case | Hook(s) | Description | Example Scenarios | Benefit |
|---|---|---|---|---|
| External-ID Resolution | transformRequest | Transforms a legacy or external identifier into the canonical resource ID expected by the retrieve operation and adds it to the shared request context as { id }. | - Resolve a legacy customer key to a Contact ID - Map a partner-system identifier to { id }- Normalize identifiers from migrated systems - Translate an account-specific reference into the canonical ID | Allows legacy clients and external integrations to retrieve resources using familiar identifiers without changing the shared API contract. |
| Role-Based or Regional Access Control | applyCustomValidations | Applies authorization and data-governance rules before the query executes. Access can be evaluated using the caller’s role, region, business unit, channel, or other request context. | - Restrict access to customers outside the user’s assigned region - Permit only supervisors to retrieve high-value customer records - Block partner channels from accessing internal-only resources - Enforce business-unit data boundaries | Enforces data-governance policies and prevents unauthorized access to protected records. |
| Toggle or Add Validation Flags | configureDefaultValidations | Enables, disables, or extends built-in validation flags for retrieve requests according to organization-specific policies. | - Require record-existence validation - Enable stricter identifier validation - Disable checks that do not apply to trusted internal channels - Apply different validation policies by tenant or environment | Allows each organization to relax or tighten retrieval checks without modifying the shared implementation. |
| Add Custom Fields or Server-Side Filters | customiseGraphQLQuery | Modifies the GraphQL query before execution by adding custom fields, relationships, filters, or server-side constraints. | - Add organization-specific Contact fields - Include entitlement or customer-hierarchy data - Apply regional, tenant, or lifecycle-status filters - Request a reduced field set for mobile clients | Returns richer, client-specific data without changing the base schema or introducing additional API versions. |
| Response Enrichment | handlePostOperation | Processes the query result before it is returned to the client. It can add calculated values, derived fields, audit metadata, or information from related systems. | - Add a calculated customer health score - Include retrieval audit metadata - Flag preferred or high-risk customers - Add aggregated financial, service, or usage insights | Delivers derived fields and audit metadata while preserving 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 the Organization GET, target the organizationData, which represents the Account 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 Organization 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):