Endorse a specific insurance policy by providing the policy ID.
API Version
67.0
Requires Chatter
No
Signature
public static ConnectApi.InsurancePolicyIssueOutputRepresentation endorseInsurancePolicy(String policyId)
Parameters
policyId
- Type: String
- ID of the insurance policy to endorse.
Return Value
Usage
Use this method to endorse a specific insurance policy. The endorsement applies pending changes to the policy and generates a transaction. The response includes the transaction ID and any errors that occurred during the endorsement process.
Example
The Apex example shows how to use the ConnectApi.InsuranceBrokerageFamily.endorseInsurancePolicy() method to endorse a specific insurance policy.
Class Definition
This Apex example shows how to endorse an insurance policy.
global class EndorseConnectDriver { global static void callEndorseConnectAPI() { Map<String, Object> input = new Map<String, Object>(); input.put('policyId', '0YTxx000000001dGAA'); Map<String, Object> output = new Map<String, Object>(); Map<String, Object> args = new Map<String, Object>(); args.put('input', input); args.put('output', output); EndorseTestConnectAPI callable = new EndorseTestConnectAPI(); Object result = callable.call('endorse', args); ConnectApi.InsurancePolicyIssueOutputRepresentation policyData = (ConnectApi.InsurancePolicyIssueOutputRepresentation) result; System.debug('Endorse Policy Data: ' + JSON.serializePretty(policyData)); if (output.containsKey('error')) { System.debug('Error: ' + output.get('error')); } } }
Usage Example
Use the EndorseTestConnectAPI class to execute the endorse action and process the result.
public class EndorseTestConnectAPI implements System.Callable { public Object call(String action, Map<String, Object> args) { Map<String, Object> inputMap = (Map<String, Object>) args.get('input'); Map<String, Object> outputMap = (Map<String, Object>) args.get('output'); if (action == 'endorse') { String policyId = (String) inputMap.get('policyId'); System.debug('Start of Connect API call to endorse policy: ' + policyId); ConnectApi.InsurancePolicyIssueOutputRepresentation policyData; try { policyData = ConnectApi.InsuranceBrokerageFamily.endorseInsurancePolicy(policyId); System.debug('Policy endorsed successfully: ' + policyData); outputMap.put('policyData', policyData); } catch (Exception e) { System.debug('Error while endorsing policy: ' + e.getMessage()); outputMap.put('error', e.getMessage()); } return policyData; } return null; } } // Execute EndorseConnectDriver.callEndorseConnectAPI();