BankReconciliation Class
Contains methods for adding, removing, and retrieving source documents from a bank reconciliation.
Note: This class and methods cannot be used in a trigger context.
BankReconciliation Methods
The following are methods for BankReconciliation. All methods are static.
clear(Id bankReconciliationId, List<Id> itemIds)
Clears and associates source documents with a bank reconciliation. By default the cleared date is set to today's date. The items can only be of type Cash Receipt, Journal Entry Line, Cash Disbursement, or Bank Deposit. A maximum of 200 items are allowed per clear method invocation.
Return Value
Type: ServiceResult
Usage
AcctSeed__Bank_Reconciliation2__c bankRec = [Select Id FROM AcctSeed__Bank_Reconciliation2__c LIMIT 1];
AcctSeed__Cash_Receipt__c cashReceipt = [Select Id FROM AcctSeed__Cash_Receipt__c WHERE AcctSeed__Bank_Reconciliation__c = NULL LIMIT 1];
List<Id> itemIds = new List<Id>();
itemIds.add(cashReceipt.Id);
AcctSeed.ServiceResult sr = AcctSeed.BankReconciliation.associate(bankRec.Id, itemIds);
clear(Id bankReconciliationId, List<Id> itemIds, Map<Id, Date> itemToClearedDate)
Clears and associates source documents with a bank reconciliation. Includes the option to map a cleared date to an item Id to clear. The items can only be of type Cash Receipt, Journal Entry Line, Cash Disbursement, or Bank Deposit. A maximum of 200 items are allowed per clear method invocation.
Return Value
Type: ServiceResult
Usage
AcctSeed__Bank_Reconciliation2__c bankRec = [Select Id FROM AcctSeed__Bank_Reconciliation2__c LIMIT 1];
AcctSeed__Cash_Receipt__c cashReceipt = [Select Id FROM AcctSeed__Cash_Receipt__c WHERE AcctSeed__Bank_Reconciliation__c = NULL LIMIT 1];
List<Id> itemIds = new List<Id>();
Map<Id, Date> itemToClearedDate = new Map<Id, Date>();
itemIds.add(cashReceipt.Id);
itemToClearedDate.put(cashReceipt.Id, Date.newInstance(2019,2,2));
AcctSeed.ServiceResult sr = AcctSeed.BankReconciliation.associate(bankRec.Id, itemIds, itemToClearedDate);
complete(Id bankReconciliationId)
Used to transition a Bank Reconciliation’s Status__c from “In Progress“ to “Completed”. If the Bank Reconciliation’s Status__c is “Completed“ an error will occur. 1. If the Bank Reconciliation’s AcctSeed__Status__c is “Working” or “In Progress” an error will occur. 1. If the Bank Reconciliation’s AcctSeed__Status__c is “In Progress” a check will ensure that the clearable items count is below the max (8,000), and if so use a DML update to set the Status__c to “Completed“.
Clearable items are: 1. Bank Deposits 1. Journal Entries 1. Cash Receipts 1. Cash Disbursements
Note: Only available in a non-trigger context. Usage in a trigger context will cause an exception.
Return Value
Type: ServiceResult
Usage
AcctSeed__Bank_Reconciliation2__c bankRec = [SELECT Id FROM AcctSeed__Bank_Reconciliation2__c WHERE AcctSeed__Status__c = ‘In Progress’ LIMIT 1];
AcctSeed.BankReconciliation.complete(bankRec.Id);
retrieve(Id bankReconciliationId)
Retrieves the source documents associated with a bank reconciliation.
Return Value
Type: BankReconciliationModel
Usage
AcctSeed__Bank_Reconciliation2__c bankRec = [Select Id FROM AcctSeed__Bank_Reconciliation2__c LIMIT 1];
AcctSeed.ServiceResult sr = AcctSeed.BankDeposit.retrieve(bankRec.Id);
unclear(Id bankReconciliationId, List<Id> itemIds)
Unclear source documents associated with a bank reconciliation. The items can only be of type Cash Receipt, Cash Disbursement, Bank Deposit, or Journal Entry Line. A maximum of 200 items are allowed per unclear method invocation.
Return Value
Type: ServiceResult
Usage
List<AcctSeed__GL_Account__c> glAccounts = [SELECT Id FROM AcctSeed__GL_Account__c WHERE AcctSeed__Bank__c = TRUE LIMIT 1];
AcctSeed__Cash_Receipt__c cashReceipt = new AcctSeed__Cash_Receipt__c();
AcctSeed.ServiceResult sr = AcctSeed.BankDeposit.unclear(Id bankReconciliationId, List<Id> itemIds);
undoComplete(Id bankReconciliationId)
Used to transition a Bank Reconciliation’s Status__c from “Completed“ (or if it is stuck “Working”) to “In Progress”. If the Bank Reconciliation’s Status__c is “In Progress“ or “Working” an error will occur.
Note: Only available in a non-trigger context. Usage in a trigger context will cause an exception.
Return Value
Type: ServiceResult
Usage
AcctSeed__Bank_Reconciliation2__c bankRec = [SELECT Id FROM AcctSeed__Bank_Reconciliation2__c WHERE AcctSeed__Status__c = ‘Completed’ LIMIT 1];
AcctSeed.BankReconciliation.undoComplete(bankRec.Id);
BankReconciliation Method Error Codes
Error Code | Error Detail | Applicable Methods |
---|---|---|
NO_INPUT_DATA | No data provided to complete the request. | clear, retrieve, unclear |
INVALID_RECORD_OR_ID | Missing or invalid record or id provided. | clear, retrieve, unclear |
INVALID_CLEAR_RECORD | Invalid record to clear * | clear |
INVALID_UNCLEAR_RECORD | Invalid record to unclear † | unclear |
NO_RECONCILIATION_ITEMS | Number of item records above limit of 200 | clear, unclear |
* The record must be posted. The record or parent record must not be associated with another Bank Reconciliation. The record must not be associated with a Bank Deposit. The record must be associated with the same bank account as the Bank Reconciliation. The record must have the same GL Variable values as the Bank Reconciliation.
† The record is not cleared with this Bank Reconciliation.