The story here is we're modifying the Avalara scripts to reduce the number of unnecessary API calls. For example, if nothing in the Avalara API request body has changed, then don't send the API call since we’ve already calculated tax with that data. We're storing a hash of the API request in a custom field so we can tell when the request body has changed.
The challenge is that sometimes Avalara calls that API in beforeSubmit (Estimate, SO, RA) and sometime it’s called in afterSubmit (Invoice, Cash Sales).
To keep our footprint small in their code, our logic is in a custom library.
In beforeSubmit, we can set the hash by referencing the current record. In afterSubmit, we need to use submitFields. I just needed to know which was which.