Problem Saving Template: Index 2, Size 2 In NetSuite


If you’ve been tinkering around with the wonderful Advanced PDF/HTML Template within NetSuite there are times when you’ll receive some ambiguous errors.

I received one today which had me scratching my head for quite some time, it was:

Problem saving template: Index: 2, Size: 2

-NetSuite Advanced Template error

Whenever you encounter this error it’s trying to tell you there’s an error in your table structure with the number of rows and cells – this will need fixing otherwise it will not save your template.

To try to debug where the error lay go back to your template and click on the Save button again to see if a different prompt occurs – if you’re lucky you’ll be given another ambiguous error, but this time you’re going to try to read this new error to determine where the FreeMarker parser is actually encountering problems.

With this line number go back and copy your parsed code and paste it into your favourite text editor to try to locate the line.

Even though this line will not likely be where the error is it will likely put you in the right area. When you are here you need to begin checking your tr and td tags and any rowspan or colspan calls within those tags.

In my case the second error was pointing me to the footer macro area of which I had the following code which produced the original ambiguous error:

<table>
    <tr>
        <td rowspan="2"></td>
    </tr>
    <tr>
        <td></td>
    </tr>
</table>

From the above you can see with my first td tag I made it span over 2 rows, however, with the second td tag it didn’t know where to go as I hadn’t created an additional column for it. In the end I amended my code to the following which made it no longer throw an error:

<table>
    <tr>
        <td></td>
        <td></td>
    </tr>
</table>

I just removed the rowspan parameter as I found I didn’t really need it and ended up combining it into one row.

Recent Posts