CreatePolicyLimits(policyId, CreatePolicyLimitsInput)

insurance policy limit records for the specified policy based on the defined attributes and coverages of the insurance policy.

Version 

64.0

Requires 

No

Signature 

public static ConnectApi.CreatePolicyLimitsRepresentation CreatePolicyLimits(String policyId, ConnectApi.CreatePolicyLimitsInputRepresentation CreatePolicyLimitsInput)

Parameters 

policyId

  • Type: String
  • of the policy to generate limits for.

CreatePolicyLimitsInput

Return Value 

Type: ConnectApi.CreatePolicyLimitsRepresentation

Example 

This Apex example shows how to call the CreatePolicyLimits method to automatically generate limit tracking records that are associated with a given policy ID.

Class Definition

1public with sharing class CreatePolicyLimitsCallable implements System.Callable {
2
3    public Object call(String action, Map<String, Object> args) {
4        // Retrieve the input and output maps from the arguments
5        Map<String, Object> inputMap = (Map<String, Object>) args.get('input');
6        Map<String, Object> outputMap = (Map<String, Object>) args.get('output');
7
8        // Check the action type
9        if (action == 'createPolicyLimits') {
10            // Retrieve the policy ID from the input map
11            String policyId = (String) inputMap.get('policyId');
12
13            System.debug('Start of connect API call to create policy limits');
14            System.debug('Policy ID: ' + policyId);
15
16            // Initialize the output representation
17            ConnectApi.CreatePolicyLimitsRepresentation policyLimitsData;
18
19            // Call the Connect API to create policy limits
20            try {
21                // Call the Connect API resource directly using the correct method signature
22                policyLimitsData = ConnectApi.InsuranceClaimFamily.createPolicyLimits(policyId);
23
24                System.debug('Policy limits created successfully: ' + policyLimitsData);
25
26                // Put the policy limits data in the output map
27                outputMap.put('policyLimitsData', policyLimitsData);
28            }
29            catch (Exception e) {
30                System.debug('Error while creating policy limits: ' + e.getMessage());
31                outputMap.put('error', e.getMessage());
32            }
33
34            // Return the policy limits data
35            return policyLimitsData;
36        }
37
38        // If the action is not recognized, return null
39        return null;
40    }
41}

Usage Example

1CreatePolicyLimitsCallable callable = new CreatePolicyLimitsCallable();
2
3// Prepare the input arguments
4Map<String, Object> input = new Map<String, Object>();
5
6// Set the policy ID (required)
7input.put('policyId', '0YTxx000000001LGAQ');
8
9// Prepare the output map
10Map<String, Object> output = new Map<String, Object>();
11
12// Prepare the args map
13Map<String, Object> args = new Map<String, Object>();
14args.put('input', input);
15args.put('output', output);
16
17// Call the 'createPolicyLimits' action
18Object result = callable.call('createPolicyLimits', args);
19
20// Check the result
21if (result != null) {
22    System.debug('Policy limits created successfully: ' + result);
23
24    // Access the created policy limits data
25    ConnectApi.CreatePolicyLimitsRepresentation policyLimitsData =
26        (ConnectApi.CreatePolicyLimitsRepresentation) result;
27
28    // Process the result as needed
29    System.debug('Policy Limits Data: ' + policyLimitsData);
30
31    // Access the generated policy limit IDs
32    if (policyLimitsData.policyLimitIds != null) {
33        System.debug('Generated Policy Limit IDs: ' + policyLimitsData.policyLimitIds);
34        System.debug('Number of limits generated: ' + policyLimitsData.policyLimitIds.size());
35    }
36} else {
37    System.debug('Error occurred: ' + output.get('error'));
38}