We’ve recently delivered an API for the Cash Matching function, that will allow our customers, partners and our Product Services Team to leverage our Cash Matching module in a more automated and customized way. The Cash Matching API will allow you to create your own cash matching rules and embed the cash matching process into your processes built on the Salesforce Platform.
This article is intended for Apex developers already familiar with FinancialForce object APIs who want a quick insight into a way of using the Cash Matching API. For information about the capability to utilise more native Apex DML features with our objects, see Using the Salesforce API.
There are many ways in which you can use the Cash Matching API. A sample scenario is provided below:
Sample Scenario : Credit Card Payments
Your company sells products over the phone and accepts credit cards as payment. A Credit Card Transaction custom object captures the details of credit card sales. A custom invoicing process is required to perform the following tasks automatically:
- Query for credit card transaction records available for invoicing.
- Generate an appropriate invoice and issue it via email to the customer.
- Generate an appropriate cash entry reflecting the payment.
- Match the two transactions using the Cash Matching API.
The following screenshot shows a sample credit card transaction custom object used by the code illustrated in this article:
IMPLEMENTATION TIP: The process described above potentially deals with many credit card transactions, each resulting in its own sales invoice, cash entry and match processes. We therefore recommend that you use the scalability provided by the Salesforce Platform Batch Apex technology on the Salesforce Platform.
- Create the sales invoice and cash entries from the credit card transaction record and then use the applicable Post APIs. Cash matching requires available account transaction lines to match against each other. The following code sample uses a DML approach: [code_inline id=2309 /]
- Post the invoice and cash entry and query the transaction line references to pass to the matching API: [code_inline id=2310 /]
- Call the Cash Matching API: [code_inline id=2311 /]
- Email the invoice and update the original Credit Card Transaction record with the matching reference returned from the API, as well as references to the Sales Invoice and Cash Entry created earlier: [code_inline id=2312 /]
The following screenshot shows how the invoice and transaction appear on the Credit Card Transaction object once the process is complete.
In our example, the matching requirements are quite simple however you can use the calling code to decide which transaction references are passed to the API. The possibilities for cash matching rules are now only limited by your imagination as a developer!
Automation is not the only use for the Cash Matching API. You can build your own cash matching user interface, as we have done recently. The new FinancialForce Extended Cash Matching package (currently available in Pilot) is shown below. This uses the Cash Matching API described in this article.
Copyright © 2011, FinancialForce.com, inc
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, ttttthis list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, ttttthis list of conditions and the following disclaimer in the documentation ttttand/or other materials provided with the distribution.
- Neither the name of the FinancialForce.com, inc nor the names of its contributors ttttmay be used to endorse or promote products derived from this software without ttttspecific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.