- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2020 03:47 PM
I'm setting the params on a SoapMessage and I have one case where one param declared in my soapmessage may consist of the markup for multiple child elements.
SoapMessage:
</Narratives>
<EventValues>${event.rows}</EventValues>
<Polices>
The data may look like so:
<EventValue sku="abc" upc="12345"/>
<EventValue sku="def" upc="5678"/>
So I would like to do this:
var rows = (an array of objects)
var rows_data = "";
for(var index = 0; index < rows.length; index++) {
var row = rows_data[index];
rows_data += `<EventValue
sku="${row[this.EVENT_VALUE_SKU]}"
upc="${row[this.EVENT_VALUE_UPC]}"
.../>`;
}
s.setStringParameterNoEscape( "event.rows", rows_data);
But the editor says there is an illegal character on the line where my template begins. I believe it does not support interpolation in this context. Is this correct, and is there a way around it?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2020 09:15 AM
To the best of my knowledge (and ability to find) ServiceNow does not support what you are describing.
From what I can find, ServiceNow only supports to to ES5:
and from what I can find, template literals were introduced in ES6:
https://developers.google.com/web/updates/2015/01/ES6-Template-Strings
So, I believe the answer is no, this is not supported currently in ServiceNow.
If this was helpful, or correct, please be kind and remember to mark appropriately!
Michael Jones - Cloudpires
Michael D. Jones
Proud member of the GlideFast Consulting Team!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2020 04:41 PM
This may just be an artifact of copy and paste, but:
rows_data += `<EventValue
That appears to be a ` character (Grave Accent) rather than a ' character (single quote)? It looks like you have the same at end:
.../>`;
Maybe try changing those to single quotes and see if that solves your issue?
If this was helpful, or correct, please be kind and remember to click appropriately!
Michael Jones - Cloudpires
Michael D. Jones
Proud member of the GlideFast Consulting Team!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2020 08:16 AM
It is the backtick, and that's intentional. According to my understanding template strings (in ES6, template literals) were added in ES5. Of ourse I can work around this using concatenation but the code is harder to read.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2020 09:15 AM
To the best of my knowledge (and ability to find) ServiceNow does not support what you are describing.
From what I can find, ServiceNow only supports to to ES5:
and from what I can find, template literals were introduced in ES6:
https://developers.google.com/web/updates/2015/01/ES6-Template-Strings
So, I believe the answer is no, this is not supported currently in ServiceNow.
If this was helpful, or correct, please be kind and remember to mark appropriately!
Michael Jones - Cloudpires
Michael D. Jones
Proud member of the GlideFast Consulting Team!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2020 03:38 PM
OK I will use concatenation.