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.

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)

1ConnectApi.InsuranceBrokerageFamily, endorseInsurancePolicy, [String], ConnectApi.InsurancePolicyIssueOutputRepresentation

Parameters

policyId
Type: String
ID of the insurance policy to endorse.

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.
1global class EndorseConnectDriver {
2
3    global static void callEndorseConnectAPI() {
4        Map<String, Object> input = new Map<String, Object>();
5        input.put('policyId', '0YTxx000000001dGAA');
6
7        Map<String, Object> output = new Map<String, Object>();
8        Map<String, Object> args = new Map<String, Object>();
9        args.put('input', input);
10        args.put('output', output);
11
12        EndorseTestConnectAPI callable = new EndorseTestConnectAPI();
13        Object result = callable.call('endorse', args);
14
15        ConnectApi.InsurancePolicyIssueOutputRepresentation policyData =
16            (ConnectApi.InsurancePolicyIssueOutputRepresentation) result;
17        System.debug('Endorse Policy Data: ' + JSON.serializePretty(policyData));
18
19        if (output.containsKey('error')) {
20            System.debug('Error: ' + output.get('error'));
21        }
22    }
23}
Usage Example
Use the EndorseTestConnectAPI class to execute the endorse action and process the result.
1public class EndorseTestConnectAPI 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 == 'endorse') {
8            String policyId = (String) inputMap.get('policyId');
9            System.debug('Start of Connect API call to endorse policy: ' + policyId);
10
11            ConnectApi.InsurancePolicyIssueOutputRepresentation policyData;
12            try {
13                policyData = ConnectApi.InsuranceBrokerageFamily.endorseInsurancePolicy(policyId);
14                System.debug('Policy endorsed successfully: ' + policyData);
15                outputMap.put('policyData', policyData);
16            } catch (Exception e) {
17                System.debug('Error while endorsing policy: ' + e.getMessage());
18                outputMap.put('error', e.getMessage());
19            }
20            return policyData;
21        }
22
23        return null;
24    }
25}
26
27// Execute
28EndorseConnectDriver.callEndorseConnectAPI();