Wolfgang
Wolfgang

Reputation: 3540

How do I <#include> one Freemarker template into another in NetSuite?

I'm trying to use Freemarker's include directive in a template, but no matter how I try to give it the file cabinet path all I get is an UNEXPECTED_ERROR. Does this directive just not work in NetSuite?

Upvotes: 0

Views: 973

Answers (1)

Wolfgang
Wolfgang

Reputation: 3540

It does work, but not with file cabinet paths. There are two options:

  1. Use the internal ID of a file in the file cabinet, like this (SuiteAnswer 68965):
    <#include "563">
    
    (Note that the file's extension must be .txt or .ftl; if NetSuite can't tell that it's a Freemarker file it will refuse to include it.)
  2. Include the template by URL. If you're using a file cabinet URL, you have to set the file to Available Without Login.
    <#include "https://system.na0.netsuite.com/core/media/media.nl?id=123&c=12345678&h=1935965101a52f6bf76d&_xt=.ftl">
    
    This will also apparently work with any other URL that serves Freemarker templates, though I haven't tried it.

Upvotes: 3

Related Questions