We are are a distributor that sells to both taxable and nontaxable customers. Additionally, we use Avalara’s AvaTax service to calculate tax rates. It was a lot of work for us to charge tax to a nontaxable customer who was not reselling the merchandise.
In order to charge tax to a nontaxable customer, we had to do the following:
- Open the nontaxable customer
- Check taxable
- Save
- Create a sales order
- Add items
- Save
- Reopen the customer
- Uncheck taxable
- Save
Whoa! What a pain. Hope the phone never rings while I’m in the middle of this checklist.
Here’s a simple solution for you developers. First, add a couple of lines to your BeforeLoad() function in the event script deployed on sales orders. I’ll include the code later so you can cut and paste.
This adds a button in the “Items” sublist of a sales order. It looks like this.
If you are reading along in the code, you’ll know you need some client-side script now. So add this code to your client script deployed against sales orders. It is called directly from the new button we just added. So just add it as a function somewhere in your client script.
Here’s a walkthrough. AvaTax adds a custom field called custbody_ava_customertaxable. This gets set when a sales order is created. It gets the customer’s tax status at the time the order is created. It is fully accessible in client scripts. I actually played around trying to set it on the server side. No luck!
So here is my code:
Server-side event script deployed on sales orders, BeforeLoad():