Voiding Customer Payment Using Reversing Journal Entry
NetSuite gives option to void transactions using reversing journals. This preference is available under Accounting Preferences section. However, when it is enabled, some of the transactions cannot be voided any more. As of the time this article published, this is still and enhancement request in NetSuite. In this article, we will cover how to approach this scenario using SuiteScript.
Our use case is to add Void button to a Customer Payment when it is applied to an Invoice. Therefore, the button will not appear when Customer Payment is not applied or applied to a Journal Entry only. For this part of the requirement, User Event Script will be used. Before record is loaded, User Event Script will check for applied transactions and when there is an Invoice detected, Client Script will be added to the form as well the custom Void button. Client script is required to have the
voidCustomerPayment function assigned that will be called when the Void button is clicked.
Role of this function is to manage the rest of the process. When triggered, informational message will be shown to the user and processing will continue on the background. The message will prevent double clicking on the button which is quite common for impatient users. Data required for posting will be captured from the Customer Payment record and passed to the Reversing Journal Entry to be created.
Before proceeding with the creation of the Reversing Journal Entry, there is a last check to make sure Accounting Period where Customer Payment is posted is not closed or Non-GL Changes are allowed. Otherwise, it is not possible to unapply the Invoice from the Customer payment and replace it with the Reversing Journal Entry. After this check, Reversing Journal Entry is created and data is passed to the Backend Suitelet which is the last part of this solution.
Role of the Backend Suitelet is:
- If not approved, automatically approve the Journal Entry
- Unapply all the transactions from the Customer Payment
- Apply Reversing Journal Entry to the Customer Payment
- If there is any Overpayment Journal applied, reverse it by a separate Reversing Journal Entry. Please see this article to see our solution about Customer Overpayments. This part can be removed from the solution as well if you do not use it.
Backend Suitelet must be set to Run as Administrator. This will ensure that limitations of the role user assigned will not stop the process.
Source code of this solution is available on our GitHub page. If you decide to deploy this solution to your account, please make sure to create use case scenarios and perform as many tests as possible before deploying to your production environment. Also, go through the code and see if all parts apply for your NetSuite environment.
We would like to hear your opinion if you liked this solution or if you think there is a place for improvement. If you have any comments on this solution, please use the section below. For any other communication, please use the form on the Contact Us page.