DeleteClaimCoveragePaymentDetail(claimId, coverageId, paymentDetailId)

Delete a claim coverage payment detail record.

API Version 

65.0

Requires Chatter 

No

Signature 

public static ConnectApi.DeleteClaimCoveragePaymentDetailRep DeleteClaimCoveragePaymentDetail(String claimId, String coverageId, String paymentDetailId)

Parameters 

claimId

  • Type: String
  • ID of the claim.

coverageId

  • Type: String
  • ID of the claim coverage record.

paymentDetailId

  • Type: String
  • ID of the claim coverage payment detail record.

Return Value 

Type: ConnectApi.DeleteClaimCoveragePaymentDetailRep

Example 

Use the DeleteClaimCoveragePaymentDetailCallable Apex class to delete an existing claim coverage payment detail record for a specified claim and coverage.

Class Definition

1public with sharing class DeleteClaimCoveragePaymentDetailCallable implements System.Callable {
2
3    public Object call(String action, Map<String, Object> args) {
4        // Retrieve the input and output maps from the arguments
5        Map<String, Object> inputMap = (Map<String, Object>) args.get('input');
6        Map<String, Object> outputMap = (Map<String, Object>) args.get('output');
7
8        // Check the action type
9        if (action == 'deleteClaimCoveragePaymentDetail') {
10            // Retrieve the required parameters from the input map
11            String claimId = (String) inputMap.get('claimId');
12            String claimCoverageId = (String) inputMap.get('claimCoverageId');
13            String claimCoveragePaymentDetailId = (String) inputMap.get('claimCoveragePaymentDetailId');
14
15            System.debug('Start of connect API call to delete claim coverage payment detail');
16            System.debug('Claim ID: ' + claimId);
17            System.debug('Claim Coverage ID: ' + claimCoverageId);
18            System.debug('Claim Coverage Payment Detail ID: ' + claimCoveragePaymentDetailId);
19
20            // Initialize the output representation
21            ConnectApi.DeleteClaimCoveragePaymentDetailRep paymentDetailData;
22
23            // Call the Connect API to delete claim coverage payment detail
24            try {
25                // Call the Connect API resource directly using the correct method signature
26                // The endpoint is: /connect/insurance/claims/${claimId}/coverages/${coverageId}/payment-details/${paymentDetailId}/delete
27                paymentDetailData = ConnectApi.InsuranceClaimFamily.deleteClaimCoveragePaymentDetail(
28                    claimId,
29                    claimCoverageId,
30                    claimCoveragePaymentDetailId
31                );
32
33                System.debug('Claim coverage payment detail deleted successfully: ' + paymentDetailData);
34
35                // Put the payment detail data in the output map
36                outputMap.put('paymentDetailData', paymentDetailData);
37                outputMap.put('isDeleted', paymentDetailData.isSuccess);
38
39                // Check if there are any errors
40                if (paymentDetailData.errors != null && !paymentDetailData.errors.isEmpty()) {
41                    outputMap.put('errors', paymentDetailData.errors);
42                    System.debug('Errors found: ' + paymentDetailData.errors);
43                }
44            }
45            catch (Exception e) {
46                System.debug('Error while deleting claim coverage payment detail: ' + e.getMessage());
47                outputMap.put('error', e.getMessage());
48                outputMap.put('isDeleted', false);
49            }
50
51            // Return the payment detail data
52            return paymentDetailData;
53        }
54
55        // If the action is not recognized, return null
56        return null;
57    }
58}

Usage Example

1DeleteClaimCoveragePaymentDetailCallable callable = new DeleteClaimCoveragePaymentDetailCallable();
2// Prepare the input arguments
3Map<String, Object> input = new Map<String, Object>();
4// Set the required parameters
5input.put('claimId', '0ZkXK00000000010AA');                    // Claim ID
6input.put('claimCoverageId', '0kPXK00000000012AA');           // Claim Coverage ID
7input.put('claimCoveragePaymentDetailId', '0l2XK000000006TYAQ'); // Claim Coverage Payment Detail ID
8// Prepare the output map
9Map<String, Object> output = new Map<String, Object>();
10// Prepare the args map
11Map<String, Object> args = new Map<String, Object>();
12args.put('input', input);
13args.put('output', output);
14// Call the 'deleteClaimCoveragePaymentDetail' action
15Object result = callable.call('deleteClaimCoveragePaymentDetail', args);
16// Check the result
17if (result != null) {
18    System.debug('Claim coverage payment detail processed successfully: ' + result);
19
20    // Access the processed payment detail data
21    ConnectApi.DeleteClaimCoveragePaymentDetailRep paymentDetailData =
22        (ConnectApi.DeleteClaimCoveragePaymentDetailRep) result;
23
24    // Process the result as needed
25    System.debug('Payment Detail Data: ' + paymentDetailData);
26
27    // Check if the payment was successful
28    if (paymentDetailData.isSuccess) {
29        System.debug('Deletion was successful');
30    } else {
31        System.debug('Deletion failed');
32        if (paymentDetailData.errors != null) {
33            System.debug('Error details: ' + paymentDetailData.errors);
34        }
35    }
36} else {
37    System.debug('Error occurred: ' + output.get('error'));
38}