---
schema_version: "1"
id: f1b6aa00738ff44bc985af2d97bcfda5f56385899b522ba9c2b29a207529d300
title: bulkRenewInsurancePolicy(insurancePolicyBulkInput)
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/insurance_developer_guide/apex_ConnectAPI_InsuranceBrokerageFamily_bulkRenewInsurancePolicy_1.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_ConnectAPI_InsuranceBrokerageFamily_bulkRenewInsurancePolicy_1.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 4d4559d97d3993022d77db01786d157c4cfc941e9aaddb8b31eb56df3a813824
description: Renew policies in bulk for the specified Insurance Policy IDs.
---
# bulkRenewInsurancePolicy(insurancePolicyBulkInput)

Renew policies in bulk for the specified Insurance Policy IDs.

## API Version

64.0

## Requires Chatter

No

## Signature

public static ConnectApi.InsurancePolicyBulkOutputRepresentation bulkRenewInsurancePolicy(ConnectApi.InsurancePolicyBulkRenewInputRepresentation insurancePolicyBulkInput)

## Parameters

**insurancePolicyBulkInput**

- Type: [ConnectApi.InsurancePolicyBulkRenewInputRepresentation](https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_connectapi_input_insurance_policy_bulk_renew.htm "Input representation details of the renew insurance policies in bulk resource. The input includes the list of insurance policy IDs to be renewed and the details of the associated fields of the insurance policies.")
- Input representation of the request to renew insurance policies in bulk.

## Return Value

Type: [ConnectApi.InsurancePolicyBulkOutputRepresentation](https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_connectapi_output_insurance_policy_bulk_output.htm "Output representation details of the bulk cancel policy resource.")

## 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.

global class BulkRenewConnectDriver {

    global static void callBulkRenewConnectAPI() {
        Map<String, Object\> input = new Map<String, Object\>();

        ConnectApi.InsurancePolicyBulkInputRepresentation bulkInput = new ConnectApi.InsurancePolicyBulkInputRepresentation();

        List<String\> policyIds = new List<String\>{
            '0YTxx000000001dGAA',
            '0YTxx000000002dGAA',
            '0YTxx000000003dGAA'
        };
        bulkInput.insurancePolicyIds = policyIds;

        Map<String, Object\> fields = new Map<String, Object\>();
        fields.put('Name', 'Bulk Renewed Policy');
        bulkInput.fieldValueMap = fields;

        input.put('bulkInput', bulkInput);

        Map<String, Object\> output = new Map<String, Object\>();
        Map<String, Object\> args = new Map<String, Object\>();
        args.put('input', input);
        args.put('output', output);

        BulkRenewTestConnectAPI callable = new BulkRenewTestConnectAPI();
        Object result = callable.call('bulkRenew', args);

        ConnectApi.InsurancePolicyBulkOutputRepresentation bulkData =
            (ConnectApi.InsurancePolicyBulkOutputRepresentation) result;
        System.debug('Bulk Renew Data: ' + JSON.serializePretty(bulkData));

        if (output.containsKey('error')) {
            System.debug('Error: ' + output.get('error'));
        }
    }
}

**Usage Example**

Use the BulkRenewTestConnectAPI class to execute the bulkRenew action and process the result.

public class BulkRenewTestConnectAPI 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 == 'bulkRenew') {
            ConnectApi.InsurancePolicyBulkInputRepresentation bulkInput =
                (ConnectApi.InsurancePolicyBulkInputRepresentation) inputMap.get('bulkInput');
            System.debug('Start of Connect API call to bulk renew policies');

            ConnectApi.InsurancePolicyBulkOutputRepresentation bulkData;
            try {
                bulkData = ConnectApi.InsuranceBrokerageFamily.bulkRenewInsurancePolicy(bulkInput);
                System.debug('Policies bulk renewed successfully: ' + bulkData);
                outputMap.put('bulkData', bulkData);
            } catch (Exception e) {
                System.debug('Error while bulk renewing policies: ' + e.getMessage());
                outputMap.put('error', e.getMessage());
            }
            return bulkData;
        }

        return null;
    }
}

// Execute
BulkRenewConnectDriver.callBulkRenewConnectAPI();