Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

UI Script template strings

-O-
Kilo Patron

I am trying to include a UI Script into a UI Page.

The script contains template strings:

var someVariable = 'Abc';
console.log(`someVariable: ${someVariable}`);

Let's say this UI Script is called (has Name) testScript.

If I fetch this script by entering .../testScript.jsdbx into the browser's URL, the returned script is modified and show up as:

var someVariable = 'Abc';
console.log(`someVariable: `);

So the ${someVariable} part has been omitted/stripped out.
How does one prevent this?

1 ACCEPTED SOLUTION

It seems this is by design and the system looks for a property with the name within the curly braces and inserts the value of that property.

As a workaround what I did was to load the file as attachment, than <g:requires />'ed that attachment.

View solution in original post

2 REPLIES 2

Joel A Hodes
Tera Contributor

I'm also getting this issue, would be interested if it's a bug or intended behaviour to sanitize code

It seems this is by design and the system looks for a property with the name within the curly braces and inserts the value of that property.

As a workaround what I did was to load the file as attachment, than <g:requires />'ed that attachment.