Saturday, March 23, 2019

Solve the error "The debits and credits are not balanced on this transaction because amounts entered include more decimal places than are supported for this currency" when processing Journal Entries via Script

When trying to setting field values for Debit and Credit Column in a Journal Entry via script one might receive an error : The debits and credits are not balanced on this transaction because amounts entered include more decimal places than are supported for this currency.

This error pops up since the value of the field you are trying to set has more than two decimal values. Please use the following function below to limit the no of digits after the decimal point.

eg : a = 5.1233456

result = a.toFixed(2);

result = 5.12

Similarly one can limit the number of digits after decimal point as desired.

No comments:

Post a Comment