Hi Everyone, I could use some help. We're develop...
# general
s
Hi Everyone, I could use some help. We're developing a third-party app that calculates tax on transactions and sets the total tax amount using the taxamountoverride field. This works perfectly on Sales Orders, but we're encountering an unexpected error when trying the same on Invoices. For context, this is being done in a User Event script on beforeLoad. Any insights or suggestions would be greatly appreciated!
y
Are you getting a script error, or is the field just not updating as expected ?
s
I am getting script error - An unexpected error has occurred. Please click here to notify support and provide your contact information.
a
You need to identify which script is causing the error. If you go to scripted records and go to the invoice, you can see all scripts. You should disable all of them except for the tax one to confirm it's not the tax script that is erroring. Some script or workflow is causing the error and you need to narrow it down to which one. Once you know which one, then that script has to be stepped through to determine where the error is coming from.
s
Yeah I did the same steps. This is the line which is causing an error, If I comment that line it's working fine. invoiceRecordType.setValue({ fieldId: 'taxamountoverride', value : Math.abs(totalTax) });
If I am adding zero tax amount then it's working fine invoiceRecordType.setValue({ fieldId: 'taxamountoverride', value : 0 });
a
@smayur taxamountoverride field is boolean, so it takes true or false. It's accepting 0 as false. You want to set this field to True or 1 and then set the taxamount field
s
@AK47 It's not Boolean, it's working fine for US and CANADA tax setup. Just getting this issue for other countries i.e. AUS