GetClaim(claimId)

Get the details of a specific claim.

API Version 

65.0

Requires Chatter 

No

Signature 

public static ConnectApi.ClaimOutputRepresentation GetClaim(String claimId)

Parameters 

claimId

  • Type: String
  • ID of the claim to retrieve the details for.

Return Value 

Type: ConnectApi.ClaimOutputRepresentation

Example 

Use this Apex example to retrieve claim details from the Claim Management system by using the Get Claim API. The example shows how to invoke the Connect API method ConnectApi.ClaimFamily.GetClaim() and handle responses and errors in Apex.

Class Definition

Here’s an example that shows how to invoke the Get Claim API by using Apex.

1// Output the claim data to the debug log
2System.debug('Claim Data: ' + JSON.serializePretty(claimData));g action, Map<String, Object> args) {
3        // Retrieve the input and output maps from the arguments
4        Map<String, Object> inputMap = (Map<String, Object>) args.get('input');
5        Map<String, Object> outputMap = (Map<String, Object>) args.get('output');
6
7        // Check the action type
8        if (action == 'getClaim') {
9            // Retrieve the claim ID from the input map
10            String claimId = (String) inputMap.get('claimId');
11            System.debug('Start of connect API call to get claim with ID: ' + claimId);
12
13            // Initialize the claim output representation
14            ConnectApi.ClaimOutputRepresentation claimData;
15
16            // Call the Connect API to get the claim
17            try {
18                claimData = ConnectApi.ClaimFamily.getClaim(claimId);
19                System.debug('Claim retrieved successfully: ' + claimData);
20
21                // Put the claim data in the output map
22                outputMap.put('claimData', claimData);
23            }
24            catch (Exception e) {
25                System.debug('Error while retrieving claim: ' + e.getMessage());
26                outputMap.put('error', e.getMessage());
27            }
28
29            // Return the claim data
30            return claimData;
31        }
32
33        // If the action is not recognized, return null
34        return null;
35    }
36}

Usage Example

You can use the GetClaimCallable class in Apex to call the getClaim action and retrieve claim details by the claim ID.

1GetClaimCallable callable = new GetClaimCallable();
2
3// Prepare the input arguments
4Map<String, Object> input = new Map<String, Object>();
5
6// Get claimId from user input (you can modify this to get from different sources)
7// Option 1: From URL parameters (if called from a Visualforce page or Lightning component)
8String claimId = ApexPages.currentPage().getParameters().get('claimId');
9
10if (String.isBlank(claimId)) {
11    System.debug('Please provide a claimId. You can set it in the input map.');
12}
13
14// Add the claimId to the input map
15input.put('claimId', claimId);
16
17// Prepare the output map
18Map<String, Object> output = new Map<String, Object>();
19
20// Prepare the args map
21Map<String, Object> args = new Map<String, Object>();
22args.put('input', input);
23args.put('output', output);
24
25// Call the 'getClaim' action
26Object result = callable.call('getClaim', args);
27
28// Retrieve the claim data from the result
29ConnectApi.ClaimOutputRepresentation claimData = (ConnectApi.ClaimOutputRepresentation) result;
30
31// Output the claim data to the debug log
32System.debug('Claim Data: ' + JSON.serializePretty(claimData));
33
34// Check for errors in the output map
35if (output.containsKey('error')) {
36    System.debug('Error: ' + output.get('error'));
37}