Newer Version Available

This content describes an older version of this product. View Latest

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)

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

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.
1global class IssueConnectDriver {
2
3    global static void callIssueConnectAPI() {
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        IssueTestConnectAPI callable = new IssueTestConnectAPI();
13        Object result = callable.call('issue', args);
14
15        ConnectApi.InsurancePolicyIssueOutputRepresentation policyData =
16            (ConnectApi.InsurancePolicyIssueOutputRepresentation) result;
17        System.debug('Issue 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 IssueTestConnectAPI class to execute the issue action and process the result.
1public class IssueTestConnectAPI 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 == 'issue') {
8            String policyId = (String) inputMap.get('policyId');
9            System.debug('Start of Connect API call to issue policy: ' + policyId);
10
11            ConnectApi.InsurancePolicyIssueOutputRepresentation policyData;
12            try {
13                policyData = ConnectApi.InsuranceBrokerageFamily.issueInsurancePolicy(policyId);
14                System.debug('Policy issued successfully: ' + policyData);
15                outputMap.put('policyData', policyData);
16            } catch (Exception e) {
17                System.debug('Error while issuing policy: ' + e.getMessage());
18                outputMap.put('error', e.getMessage());
19            }
20            return policyData;
21        }
22
23        return null;
24    }
25}
26
27// Execute
28IssueConnectDriver.callIssueConnectAPI();