Use Case:
Users may encounter the following error when printing a transaction using an Advanced PDF/HTML Template:
java.lang.StringIndexOutOfBoundsException: String Index out of Range: 0
This error is commonly caused by empty or invalid field values referenced within the Advanced PDF/HTML Template script or formatting logic.
Reviewing and correcting the referenced fields in the template resolves the issue and allows the transaction to print successfully.
How It Works:
- Navigate to Customization > Forms > Advanced PDF/HTML Templates
- Locate the preferred Advanced PDF/HTML Template and click Edit
- Review the template source code and identify fields or formulas that may contain blank or null values.
- Verify that all referenced fields contain valid data and update the template logic as needed to handle empty values properly.
Example:
- Add conditions to prevent string functions from processing blank fields
- Remove unnecessary field references causing the error - After making the necessary updates, click Save
This will prevent the "java.lang.StringIndexOutOfBoundsException: String Index out of Range: 0" error when printing transactions using the Advanced PDF/HTML Template.