Cancel policies in bulk for the specified Insurance Policy IDs.
API Version
64.0
Requires Chatter
No
Signature
public static ConnectApi.InsurancePolicyBulkOutputRepresentation bulkCancelInsurancePolicy(ConnectApi.InsurancePolicyBulkInputRepresentation insurancePolicyBulkInput)
Use this method to cancel insurance policies in bulk. The JSON input includes a field value map of insurance policy fields, such as CancellationEffectiveDate, Status, and CancellationReason, and a list of insurance policy IDs. After the request is successfully sent to the message queue, policies are canceled asynchronously, and you receive either a success or failure notification after the completion of the request.
Example
The Apex example shows how to use the ConnectApi.InsuranceBrokerageFamily.bulkCancelInsurancePolicy() method to cancel multiple insurance policies in bulk.
Class Definition
This Apex example shows how to cancel multiple policies in bulk.
1global class BulkCancelConnectDriver{23 global static void callBulkCancelConnectAPI(){4 Map<String, Object>input = new Map<String, Object>();56 ConnectApi.InsurancePolicyBulkInputRepresentation bulkInput = new ConnectApi.InsurancePolicyBulkInputRepresentation();78 List<String>policyIds = new List<String>{9 '0YTxx000000001dGAA',10 '0YTxx000000002dGAA',11 '0YTxx000000003dGAA'12};13 bulkInput.insurancePolicyIds = policyIds;1415 Map<String, Object>fields = new Map<String, Object>();16 fields.put('CancellationReason', 'Batch Cancellation');17 fields.put('CancellationEffectiveDate', '2026-07-01');18 bulkInput.fieldValueMap = fields;1920 input.put('bulkInput', bulkInput);2122 Map<String, Object>output = new Map<String, Object>();23 Map<String, Object>args = new Map<String, Object>();24 args.put('input', input);25 args.put('output', output);2627 BulkCancelTestConnectAPI callable = new BulkCancelTestConnectAPI();28 Object result = callable.call('bulkCancel', args);2930 ConnectApi.InsurancePolicyBulkOutputRepresentation bulkData =31(ConnectApi.InsurancePolicyBulkOutputRepresentation)result;32 System.debug('Bulk Cancel Data: ' + JSON.serializePretty(bulkData));3334 if(output.containsKey('error')){35 System.debug('Error: ' + output.get('error'));36}37}38}
Usage Example
Use the BulkCancelTestConnectAPI class to execute the bulkCancel action and process the result.