Skip to main content
Avalara Help Center

Why am I receiving the error message "LengthError?"

Overview

Receiving a length error message that says: "CustomerCode length must be between 1 and 50 characters."

Environment

Apex2 Avalara SDK

Resolution

Length Errors will occur when the length of text passed in a string of data exceeds the maximum limit of the data field being used. In this particular case the text string that was passed in the CustomerCode field exceeded it's length because there was 58 characters. What may not be known is that the field length of a text  field also counts spaces and any special characters hat are passed as well as the characters themselves. 

For example:   The Quick Brown Fox Jumped Over the Lazy Dogs Back!   has 42 characters however counting the spaces and punctuation it has 51 characters which would be one over he limit for CustomerCode field.

 

The Developer Network resource API Reference has a complete listing of our data elements with regards to length,  data type and purpose. Visit this link and select the integration that closely matches yours:   http://developer.avalara.com/api-docs/api-reference/