Newer Version Available

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

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
Type: ConnectApi.UpdateClaimCoverageInputRepresentation
Details of the claim coverage.

Example

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

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