UpdateClaimCoverage(claimId, coverageId, UpdateClaimCoverageInput)

Update the details of a specific coverage in a claim.

API Version 

65.0

Requires Chatter 

No

Signature 

public static ConnectApi.ClaimCoverageRepresentation UpdateClaimCoverage(String claimId, String coverageId, ConnectApi.UpdateClaimCoverageInputRepresentation UpdateClaimCoverageInput)

Parameters 

claimId

  • Type: String
  • ID of the claim.

coverageId

  • Type: String
  • ID of the claim coverage to update.

UpdateClaimCoverageInput

Return Value 

Type: ConnectApi.ClaimCoverageRepresentation

Example 

The Apex example shows how to use the ConnectApi.InsuranceClaimFamily.UpdateClaimCoverage() method to update a claim coverage for an existing claim.

Class Definition

1public with sharing class UpdateClaimCoverageCallable implements System.Callable {
2
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
10       // Check the action type
11       if (action == 'updateClaimCoverage') {
12           // Retrieve the coverage input data from the input map
13           ConnectApi.UpdateClaimCoverageInputRepresentation coverageInput = (ConnectApi.UpdateClaimCoverageInputRepresentation) inputMap.get('coverageInput');
14           System.debug('Start of connect API call to update claim coverage');
15
16
17           // Initialize the coverage output representation
18           ConnectApi.ClaimCoverageRepresentation coverageData;
19
20
21           // Call the Connect API to update the claim coverage
22           try {
23               coverageData = ConnectApi.ClaimFamily.updateClaimCoverage('0Zkxx00000000JNCAY', '0kPxx00000000RREAY', coverageInput);
24               System.debug('Claim coverage updated successfully: ' + coverageData);
25
26
27               // Put the coverage data in the output map
28               outputMap.put('coverageData', coverageData);
29           }
30           catch (Exception e) {
31               System.debug('Error while updating claim coverage: ' + e.getMessage());
32               outputMap.put('error', e.getMessage());
33           }
34
35
36           // Return the coverage data
37           return coverageData;
38       }
39
40
41       // If the action is not recognized, return null
42       return null;
43   }
44}

Usage Example

This example shows how to call the class and include the required input data.

1UpdateClaimCoverageCallable
1UpdateClaimCoverageCallable callable = new UpdateClaimCoverageCallable();
2
3
4// Prepare the input arguments
5Map<String, Object> input = new Map<String, Object>();
6
7
8// Create and populate the UpdateClaimCoverageInputRepresentation object
9ConnectApi.UpdateClaimCoverageInputRepresentation coverageInput = new ConnectApi.UpdateClaimCoverageInputRepresentation();
10
11
12// Set optional fields for update
13coverageInput.lossReserveAmount = 30000.00;
14coverageInput.expenseReserveAmount = 3000.00;
15
16
17// Set additional fields
18Map<String, Object> additionalFields = new Map<String, Object>();
19additionalFields.put('Description', 'Updated coverage for vehicle damage claim');
20coverageInput.additionalFields = additionalFields;
21
22
23// Add the coverageInput to the input map
24input.put('coverageInput', coverageInput);
25
26
27// Prepare the output map
28Map<String, Object> output = new Map<String, Object>();
29
30
31// Prepare the args map
32Map<String, Object> args = new Map<String, Object>();
33args.put('input', input);
34args.put('output', output);
35
36
37// Call the 'updateClaimCoverage' action
38Object result = callable.call('updateClaimCoverage', args);
39
40
41// Retrieve the coverage data from the result
42ConnectApi.ClaimCoverageRepresentation coverageData = (ConnectApi.ClaimCoverageRepresentation) result;
43
44
45// Output the coverage data to the debug log
46System.debug('Updated Coverage Data: ' + JSON.serializePretty(coverageData));
47
48
49// Check for errors in the output map
50       if (output.containsKey('error')) {
51       System.debug('Error: ' + output.get('error'));
52       }