issueInsurancePolicy(policyId)

Issue a specific insurance policy by providing the policy ID.

API Version

67.0

Requires Chatter

No

Signature

public static ConnectApi.InsurancePolicyIssueOutputRepresentation issueInsurancePolicy(String policyId)

Parameters

policyId

  • Type: String
  • ID of the insurance policy to issue.

Usage

Use this method to issue a specific insurance policy. Issuing a policy transitions it from a draft or pending state to an active state. The response includes the transaction ID and any errors that occurred during the issue process.

Example

The Apex example shows how to use the ConnectApi.InsuranceBrokerageFamily.issueInsurancePolicy() method to issue a specific insurance policy.

Class Definition

This Apex example shows how to issue an insurance policy.

global class IssueConnectDriver {

    global static void callIssueConnectAPI() {
        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);

        IssueTestConnectAPI callable = new IssueTestConnectAPI();
        Object result = callable.call('issue', args);

        ConnectApi.InsurancePolicyIssueOutputRepresentation policyData =
            (ConnectApi.InsurancePolicyIssueOutputRepresentation) result;
        System.debug('Issue Policy Data: ' + JSON.serializePretty(policyData));

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

Usage Example

Use the IssueTestConnectAPI class to execute the issue action and process the result.

public class IssueTestConnectAPI 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 == 'issue') {
            String policyId = (String) inputMap.get('policyId');
            System.debug('Start of Connect API call to issue policy: ' + policyId);

            ConnectApi.InsurancePolicyIssueOutputRepresentation policyData;
            try {
                policyData = ConnectApi.InsuranceBrokerageFamily.issueInsurancePolicy(policyId);
                System.debug('Policy issued successfully: ' + policyData);
                outputMap.put('policyData', policyData);
            } catch (Exception e) {
                System.debug('Error while issuing policy: ' + e.getMessage());
                outputMap.put('error', e.getMessage());
            }
            return policyData;
        }

        return null;
    }
}

// Execute
IssueConnectDriver.callIssueConnectAPI();