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