Specifies how any available outstanding cash or credit note is automatically matched to other sales invoices, credit notes or cash for the same account.
Value
Description
ExactOnly
Cash will be matched to sales invoices, credit notes or cash only if they have the correct reference. This is the default option.
DocumentNumberOldestFirst
Cash will be matched to sales invoices, credit notes or cash starting from the oldest document number. For example, an invoice with the number SIN000067 will be matched before an invoice with the number SIN000100.
DocumentNumberNewestFirst
Cash will be matched to sales invoices, credit notes or cash starting from the newest document number. For example, an invoice with the number SIN000100 will be matched before an invoice with the number SIN000067.
OutstandingValueHighestFirst
Cash will be matched to sales invoices, credit notes or cash starting from the invoice with the highest outstanding value. For example, an invoice with an outstanding value of 300.00 will be matched before an invoice with an outstanding value of 150.00.
OutstandingValueLowestFirst
Cash will be matched to sales invoices, credit notes or cash starting from the invoice with the lowest outstanding value. For example, an invoice with an outstanding value of 150.00 will be matched before an invoice with an outstanding value of 300.00.
DateOldestFirst
Cash will be matched to sales invoices, credit notes or cash starting from the oldest invoice date. For example, an invoice with a date of May 30 2015 will be matched before an invoice with a date of June 1 2015.
DateNewestFirst
Cash will be matched to sales invoices, credit notes or cash starting from the newest invoice date. For example, an invoice with a date of June 1 2015 will be matched before an invoice with a date of May 30 2015.
global static Id match(c2g.BackgroundMatchingService.Configuration configuration)
This service allows you to match outstanding transactions asynchronously. See "About Background Matching" in the FinancialForce Help for more details. Use the CashEntryMatch (Process Cash Matching) custom permission to grant permissions on this method.
global static Id matchCash(c2g.BackgroundMatchingService.Configuration configuration)
This service allows you to match outstanding transactions asynchronously. See "About Background Matching" in the FinancialForce Help for more details. Use the CashEntryMatch (Process Cash Matching) custom permission to grant permissions on this method.
Starts an AsyncApexJob that matches Cash Entry Lines/Credit Note Lines to Cash Entry Lines/Invoice/Credit Note Lines based on the provided configuration using Async API Framework. If nothing is passed in configuration it will be defaulted to company defaults if applicable except Match Mode and Matching Date. Matching Date will be set to current date and Match Mode will be Exact Only if not passed. In Configuration, you cannot provide Company IDs when you are providing transaction line items.
Return Value
This service returns the ID of a Process Run object.
global static c2g.BackgroundMatchingService.MatchResult match(c2g.BackgroundMatchingService.Configuration configuration, List<Id> transactionLines)
This service allows you to match outstanding transactions synchronously. See "About Background Matching" in the FinancialForce Help for more details. Use the CashEntryMatch (Process Cash Matching) custom permission to grant permissions on this method.
This service matches invoices to cash based on the provided configuration synchronously.
transactionLines
List<Id>
Matches invoice transaction lines, specified by their IDs, to cash based on the provided configuration synchronously.
Return Value
This service returns a c2g.BackgroundMatchingService.MatchResult object.
Sample Code
//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.
Standard data setup.
1 - Create and select company.
2 - Setup accounting currencies, GLAs and Years and periods, tax codes, bank account etc.
3 - Create and post cash entries and invoices.
4 - Find out the ids of the transaction lines that relate to the invoice lines you have created.
// Create the configuration
BackGroundMatchingService.Configuration configuration = new BackGroundMatchingService.Configuration();
// Set the Match Type
configuration.MatchType = BackGroundMatchingService.MatchType.DocumentReference;
// Do the Matching
BackgroundMatchingService.MatchResult matchResult = BackgroundMatchingService.match( configuration, transactionLineIds);
This performs background matching for all the invoice transaction lines retrieved using the passed IDs and applying the following conditions:
MatchingStatus = 'Available'
LineType__c = 'Account'
Transaction__r.TransactionType__c = 'Invoice'
OwnerCompany__c = current company
global static c2g.BackgroundMatchingService.MatchResult matchCash(c2g.BackgroundMatchingService.Configuration configuration, List<Id> transactionLines)
This service allows you to match outstanding transactions synchronously. See "About Background Matching" in the FinancialForce Help for more details. Use the CashEntryMatch (Process Cash Matching) custom permission to grant permissions on this method.
This service matches Cash Entry Lines/Credit Note Lines to Cash Entry Lines/Invoice/Credit Note Lines based on the provided configuration synchronously.
transactionLines
List<Id>
Matches cash transaction lines, specified by their IDs, to invoice or credit notes based on the provided configuration synchronously.
Return Value
This service returns a c2g.BackgroundMatchingService.MatchResult object.
Sample Code
//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.
Standard data setup.
1 - Create and select company.
2 - Setup accounting currencies, GLAs and Years and periods, tax codes, bank account etc.
3 - Create and post cash entries and invoices.
4 - Find out the ids of the transaction lines that relate to the cash lines you have created.
// Create the configuration
BackGroundMatchingService.Configuration configuration = new BackGroundMatchingService.Configuration();
// Set the Match Type
configuration.MatchType = BackGroundMatchingService.MatchType.DocumentReference;
// Do the Matching
BackgroundMatchingService.MatchResult matchResult = BackgroundMatchingService.matchCash( configuration, transactionLineIds);
This performs background matching for all the cash transaction lines retrieved using the passed IDs and applying the following conditions:
MatchingStatus = 'Available'
LineType__c = 'Account'
Transaction__r.TransactionType__c = 'Cash'
OwnerCompany__c = current company
Standard data setup.
1 - Create and select multiple companies.
2 - Setup accounting currencies, GLAs and Years and periods, tax codes, bank account etc.
3 - Create and post cash entries and invoices for those companies.
// Create the configuration
BackGroundMatchingService.Configuration configuration = new BackGroundMatchingService.Configuration();
// Set the Match Type
configuration.MatchType = BackgroundMatchingService.MatchType.DocumentNumber;
configuration.CurrencyMode = BackgroundMatchingService.CurrencyMode.Account;
configuration.Mode = BackgroundMatchingService.MatchMode.DocumentNumberNewestFirst;
configuration.CompanyIds = new List<Id>{'a3m56000000L4bKAAS', 'a3m56000000L4bHASS'};
configuration.MatchingDateModeType = BackgroundMatchingService.MatchingDateMode.CashEntryDate;
// Do the Matching
Id processRunId = BackgroundMatchingService.matchCash( configuration);
specifies whether matching should be performed based on customer reference or document number. This is required when using Company IDs to match for single or multiple companies. In single company mode, this takes the default value from the selected company.
PartialPayment
Boolean
if true, two transaction lines can be matched, even if their amounts are not same. This is required when using Company IDs to match for single or multiple companies. In single company mode, this takes the default value from the selected company.
MatchingDate
Date
the matching date. current date is used by default.
MatchUptoDate
Date
the date to match up to. any cash entries, sales invoices and sales credit notes with a document date later than this date will not be matched. current date is used by default.
specifies how any available outstanding cash or credit note should be automatically matched to other sales invoice or credit note for the same account.
AccountIds
Set<Id>
identifies the accounts whose transactions you want to match. by default background matching is performed for all accounts.
CashEntryIds
Set<Id>
identifies the cash entry whose transactions you want to match.
specifies whether matching should be in the currency of the account, or the currency of the posted document. This is required when using Company IDs to match for single or multiple companies. In single company mode, this takes the default value from the selected company.
MatchCurrency
String
specifies whether you are interested in one particular currency, or all currencies. The default value is All Currencies.
CompanyIds
List<Id>
specifies whether matching should be performed for single or multiple companies.
specifies match actions to execute in the process. the processes are executed in the order in which match actions are passed. Till Spring 21 release, matchCash() synchronous method was matching cash entries to invoices and credit notes. Fall 21 onwards, if no Match Action is passed explicitly then it will match cash entries to invoices only. By default, the CASHRECEIPT_TO_INVOICE match action is executed in the synchronous call if nothing is passed. The CASHRECEIPT_TO_INVOICE and CASHREFUND_TO_CREDITNOTE match actions are executed in the asynchronous call if nothing is passed. We recommend that you check the default order in the "About Background Matching" in the FinancialForce Accounting Help.
the type of transaction for which the details relate.
TotalMatchValue
Decimal
the total value matched for this transaction type. The value could be postive or negative based on the type of document: SIN: Positive SCN: Negative CSH(Receipt): Negative CSH(Refund): Positive
Discount
Decimal
the total discount applied for the transaction type.
Matches
Integer
the total number of matches performed for this transaction type.
the details of the match separated by transaction type.
CashMatchingReferences
List<Id>
the ids of the cash matching references created during the match.
UnProcessedTransactionLineIdSet
List<Id>
contains transaction line ids which are to be matched but were not processed because the number of matching references created exceeds the custom setting "cash matching settings (ff) - background matching references threshold", or a service limitation is reached.