---
schema_version: "1"
id: 2f11bfb8963351b80219c3638f355628d117e7309a8fc9997cb839aca2fd0e8b
title: endorseInsurancePolicy(policyId)
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/insurance_developer_guide/apex_ConnectAPI_InsuranceBrokerageFamily_endorseInsurancePolicy_1.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_ConnectAPI_InsuranceBrokerageFamily_endorseInsurancePolicy_1.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 0f56ca0f698ab30c0b1bee2096263069538aef52cb34660f9781164aaee5a2ab
description: Endorse a specific insurance policy by providing the policy ID.
---
# endorseInsurancePolicy(policyId)

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

Type: [ConnectApi.InsurancePolicyIssueOutputRepresentation](https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_connectapi_output_insurance_policy_issue_output.htm "Output representation for the issue or endorse policy response. Contains the transaction ID and any errors that occurred during the process.")

## 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();