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