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.
ProcessPolicyLimits(ProcessPolicyLimitsInput, claimId, coverageId)
Process the policy limits for a loss item in a claim by using the current standings of
the insurance policy limits.
API Version
65.0
Requires Chatter
No
Signature
public static ConnectApi.ProcessPolicyLimitsRepresentation ProcessPolicyLimits(ConnectApi.ProcessPolicyLimitsInputRepresentation ProcessPolicyLimitsInput, String claimId, String coverageId)
Parameters
- ProcessPolicyLimitsInput
- Type: ConnectApi.ProcessPolicyLimitsInputRepresentation
- JSON object that contains details for processing the policy limits.
- claimId
- Type: String
- ID of the claim.
- coverageId
- Type: String
- ID of the claim coverage.
Return Value
Example
Here's an example of how to invoke the Process Policy Limits API by using Apex.
1public with sharing class PostApiCalloutProcessLimitTest implements System.Callable {
2public Object call(String action, Map<String, Object> args) {
3System.debug('>>> Action: ' + action);
4System.debug('>>> Args: ' + JSON.serializePretty(args));
5Map<String, Object> bodyMap = new Map<String, Object>();
6// Extract 'input' from args
7Map<String, Object> inputMap = (Map<String, Object>)args.get('input');
8Map<String, Object> outputMap = (Map<String, Object>)args.get('output');
9String claimId;
10String claimCoverageId;
11String CLAIM_ID = 'claimId';
12String CLAIM_COVERAGE_ID = 'claimCoverageId';
13String ADJUSTED_AMOUNT = 'adjustedAmount';
14String LIMIT_UNIT_COUNT = 'limitUnitCount';
15String BENEFIT_NAME = 'benefitName';
16if (inputMap != null) {
17if (inputMap.containsKey(ADJUSTED_AMOUNT) &&
18inputMap.get(ADJUSTED_AMOUNT) != null) {
19bodyMap.put(ADJUSTED_AMOUNT,
20String.valueOf(inputMap.get(ADJUSTED_AMOUNT)));
21} if (inputMap.containsKey(LIMIT_UNIT_COUNT) &&
22inputMap.get(LIMIT_UNIT_COUNT) != null) {
23bodyMap.put(LIMIT_UNIT_COUNT,
24String.valueOf(inputMap.get(LIMIT_UNIT_COUNT)));
25} if (inputMap.containsKey(BENEFIT_NAME) && inputMap.get(BENEFIT_NAME) != null)
26{
27
28bodyMap.put(BENEFIT_NAME, String.valueOf(inputMap.get(BENEFIT_NAME)));
29} if (inputMap.containsKey(CLAIM_ID) && inputMap.get(CLAIM_ID) != null) {
30claimId = String.valueOf(inputMap.get(CLAIM_ID));
31} if (inputMap.containsKey(CLAIM_COVERAGE_ID) &&
32inputMap.get(CLAIM_COVERAGE_ID) != null) {
33
34claimCoverageId = String.valueOf(inputMap.get(CLAIM_COVERAGE_ID));
35}
36}
37
38String jsonBody = JSON.serialize(bodyMap);
39System.debug('>>> Final JSON Body: ' + jsonBody);
40System.debug('>>> Claim Id : ' + claimId);
41System.debug('>>> Claim Coverage Id : ' + claimCoverageId);
42String str = postDataToExternalApi(jsonBody, claimId, claimCoverageId);
43return outputMap.put('response', str);
44}
45public static String postDataToExternalApi(String jsonBody, String claimId, String
46claimCoverageId) {
47HttpRequest request = new HttpRequest();
48Http http = new Http();
49
50// Endpoint for Process Limits
51String url = 'callout:invokeUW/services/data/v65.0/connect/insurance/'
52
53+ 'claims/' + claimId + '/coverages/' + claimCoverageId + '/process-limits';
54
55request.setEndpoint(url);
56request.setMethod('POST');
57request.setHeader('Content-Type', 'application/json');
58request.setTimeout(120000); // 2 mins timeout
59request.setBody(jsonBody);
60System.debug('>>> Calling Process Limits API');
61System.debug('>>> Calling Endpoint : ' + url );
62try {
63HttpResponse response = http.send(request);
64System.debug('>>> Status Code: ' + response.getStatusCode());
65System.debug('>>> Response Body: ' + response.getBody());
66return response.getBody();
67} catch (Exception e) {
68System.debug('🔥 Exception: ' + e.getMessage());
69return 'Exception: ' + e.getMessage();
70}
71}
72}