Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
bulkRenewInsurancePolicy(insurancePolicyBulkInput)
API Version
64.0
Requires Chatter
No
Signature
public static ConnectApi.InsurancePolicyBulkOutputRepresentation bulkRenewInsurancePolicy(ConnectApi.InsurancePolicyBulkRenewInputRepresentation insurancePolicyBulkInput)
1ConnectApi.InsuranceBrokerageFamily, bulkRenewInsurancePolicy, [ConnectApi.InsurancePolicyBulkRenewInputRepresentation], ConnectApi.InsurancePolicyBulkOutputRepresentationParameters
- insurancePolicyBulkInput
- Type: ConnectApi.InsurancePolicyBulkRenewInputRepresentation
- Input representation of the request to renew insurance policies in bulk.
Return Value
Usage
Insurance Policy Bulk Renewal API takes a JSON input that contains a list of insurance policy IDs that must be renewed along with the fieldValueMap details. The API submits the request to a queue, creates policies, along with child records by using the context definition selected in setup. The service also overrides the fieldValueMap in the new policy for each policy ID passed in the request. Users receive success and failure notifications on completion.
Keep these considerations in mind when you use this method.
- The RenewedFromPolicyId value of the new policy is set to the current policy ID and IsRenewedPolicy field of the new policy is set to true.
- The name of the new policy is a copy of {ExistingName}.
- The fieldValueMap expects the keys to be API name and is case-sensitive.
Example
The Apex example shows how to use the ConnectApi.InsuranceBrokerageFamily.bulkRenewInsurancePolicy() method to renew multiple insurance policies in bulk.
- Class Definition
- This Apex example shows how to renew multiple policies in bulk.
-
1global class BulkRenewConnectDriver { 2 3 global static void callBulkRenewConnectAPI() { 4 Map<String, Object> input = new Map<String, Object>(); 5 6 ConnectApi.InsurancePolicyBulkInputRepresentation bulkInput = new ConnectApi.InsurancePolicyBulkInputRepresentation(); 7 8 List<String> policyIds = new List<String>{ 9 '0YTxx000000001dGAA', 10 '0YTxx000000002dGAA', 11 '0YTxx000000003dGAA' 12 }; 13 bulkInput.insurancePolicyIds = policyIds; 14 15 Map<String, Object> fields = new Map<String, Object>(); 16 fields.put('Name', 'Bulk Renewed Policy'); 17 bulkInput.fieldValueMap = fields; 18 19 input.put('bulkInput', bulkInput); 20 21 Map<String, Object> output = new Map<String, Object>(); 22 Map<String, Object> args = new Map<String, Object>(); 23 args.put('input', input); 24 args.put('output', output); 25 26 BulkRenewTestConnectAPI callable = new BulkRenewTestConnectAPI(); 27 Object result = callable.call('bulkRenew', args); 28 29 ConnectApi.InsurancePolicyBulkOutputRepresentation bulkData = 30 (ConnectApi.InsurancePolicyBulkOutputRepresentation) result; 31 System.debug('Bulk Renew Data: ' + JSON.serializePretty(bulkData)); 32 33 if (output.containsKey('error')) { 34 System.debug('Error: ' + output.get('error')); 35 } 36 } 37} - Usage Example
- Use the BulkRenewTestConnectAPI class to execute the bulkRenew action and process the result.
-
1public class BulkRenewTestConnectAPI implements System.Callable { 2 3 public Object call(String action, Map<String, Object> args) { 4 Map<String, Object> inputMap = (Map<String, Object>) args.get('input'); 5 Map<String, Object> outputMap = (Map<String, Object>) args.get('output'); 6 7 if (action == 'bulkRenew') { 8 ConnectApi.InsurancePolicyBulkInputRepresentation bulkInput = 9 (ConnectApi.InsurancePolicyBulkInputRepresentation) inputMap.get('bulkInput'); 10 System.debug('Start of Connect API call to bulk renew policies'); 11 12 ConnectApi.InsurancePolicyBulkOutputRepresentation bulkData; 13 try { 14 bulkData = ConnectApi.InsuranceBrokerageFamily.bulkRenewInsurancePolicy(bulkInput); 15 System.debug('Policies bulk renewed successfully: ' + bulkData); 16 outputMap.put('bulkData', bulkData); 17 } catch (Exception e) { 18 System.debug('Error while bulk renewing policies: ' + e.getMessage()); 19 outputMap.put('error', e.getMessage()); 20 } 21 return bulkData; 22 } 23 24 return null; 25 } 26} 27 28// Execute 29BulkRenewConnectDriver.callBulkRenewConnectAPI();