Newer Version Available
createBillingSchedulesFromTransaction(InsuranceTransactionBillingInput)
Create billing schedules from an insurance transaction.
API Version
66.0
Requires Chatter
No
Signature
public static ConnectApi.InsuranceTransactionBillingOutputRepresentation createBillingSchedulesFromTransaction(ConnectApi.InsuranceTransactionBillingInputRepresentation InsuranceTransactionBillingInput)
Parameters
- InsuranceTransactionBillingInput
- Type: ConnectApi.InsuranceTransactionBillingInputRepresentation
- Details to create billing schedules from an insurance transaction.
Return Value
Type: ConnectApi.InsuranceTransactionBillingOutputRepresentation
Example
This is a sample to call the Create Billing Schedules connect API from Apex.
- Class Definition
-
1 2public with sharing class CreateInsuranceBillingScheduleCallable implements System.Callable{ 3 4 public Object call(String actionType, Map<String, Object> args) { 5 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 // Retrieve the insurance policy transaction input data from the input map 11 ConnectApi.InsuranceTransactionBillingInputRepresentation insuranceTransactionInput = (ConnectApi.InsuranceTransactionBillingInputRepresentation)inputMap.get('insuranceTransactionInput'); 12 String insPolicyTransactionId = (String) inputMap.get('insPolicyTransactionId'); 13 14 System.debug('Start of connect API call to Insurance Transaction Billing'); 15 16 // Initialize the insurance transaction billing output representation 17 ConnectApi.InsuranceTransactionBillingOutputRepresentation transactionBillingOutcome; 18 19 // Call the Connect API to send the insurance transaction to billing 20 try { 21 transactionBillingOutcome = ConnectApi.InsuranceBillingFamily.createBillingSchedulesFromTransaction(insuranceTransactionInput); 22 System.debug('Policy transaction send to billing successfully: ' + transactionBillingOutcome); 23 // Put the transaction billing outcome in the output map 24 outputMap.put('transactionBillingOutcome', transactionBillingOutcome); 25 } catch (Exception e) { 26 System.debug('Error while sending transaction to billing: ' + e.getMessage()); 27 outputMap.put('error', e.getMessage()); 28 } 29 // Return the transaction billing outcome 30 return transactionBillingOutcome; 31 } 32} - Usage Example
-
1global class ConnectDriver { 2 3 global static void callInsuranceBillingConnectAPI(String insPolicyTransactionId){ 4 Map<String, Object> input = new Map<String, Object>(); 5 CreateInsuranceBillingScheduleCallable callable = new CreateInsuranceBillingScheduleCallable(); 6 7 // Create and populate the InsuranceTransactionBillingInputRepresentation object 8 ConnectApi.InsuranceTransactionBillingInputRepresentation insuranceTransactionInput = new ConnectApi.InsuranceTransactionBillingInputRepresentation(); 9 10 // Populate transactionId for InsuranceTransactionBillingInputRepresentation 11 insuranceTransactionInput.insPolicyTransactionId = insPolicyTransactionId; 12 13 // Add the insuranceTransactionInput to the input map 14 input.put('insuranceTransactionInput', insuranceTransactionInput); 15 16 // Prepare the output map 17 Map<String, Object> output = new Map<String, Object>(); 18 19 // Prepare the args map 20 Map<String, Object> args = new Map<String, Object>(); 21 args.put('input', input); 22 args.put('output', output); 23 24 // Call the 'insuranceBillingService' action 25 Object result = callable.call('InsuranceBilling', args); 26 27 // Retrieve the policy data from the result 28 ConnectApi.InsuranceTransactionBillingOutputRepresentation transactionBillingOutcome = (ConnectApi.InsuranceTransactionBillingOutputRepresentation) result; 29 30 // Output the policy data to the debug log 31 System.debug('Insurance Transaction Billing API Response: ' + JSON.serializePretty(transactionBillingOutcome)); 32 33 // Check for errors in the output map 34 if (output.containsKey('error')) { 35 System.debug('Error: ' + output.get('error')); 36 } 37 } 38}