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.

Ryan

Author of scripteverything.com, Ryan has been dabbling in code since the late '90s when he cut his teeth by exploring VBA in Excel when trying to do something more. Having his eyes opened with the potential of automating repetitive tasks, he expanded to Python and then moved over to scripting languages such as HTML, CSS, Javascript and PHP. When he is not behind a screen, Ryan enjoys a good bush walk with the family during the cooler months, and going with them to the beach during the warmer months.

Recent Posts