- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2024 04:44 AM - edited 08-05-2024 04:55 AM
Hello,
The Xanadu highlights in docs state:
- Use ECMAScript 2021 (ES12) features in any server-side script.
I understand this to also mean Global scope, in scoped apps this has been available since Tokyo. I spun up a PDI which is running on build `glide-xanadu-07-02-2024__patch0-07-16-2024`
Apart from `const` and `let` no new ES features seem to be working. I was trying template literals, for...of loop, arrow function and spread operator. I tried running both in a Fix Script so I could make sure the ES12 toggle was on, and in background script. But the result isn't good.
Script compilation error: Script Identifier: null.null.script, Error Description: syntax error (null.null.script; line 4), Script ES Level: 0, Interpreted Mode: true
bg script
fix script
In a scoped app the same script runs like a charm
The docs also state "No plugins or properties are required to install the new JavaScript engine." So what gives? Any ideas?
edit: maybe this post went into a wrong category - idk how to change it though
Solved! Go to Solution.
- 5,934 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2024 05:23 AM - edited 11-15-2024 05:24 AM
Still not working in Patch 3 (glide-xanadu-07-02-2024__patch3-10-23-2024)
Got reply from SN:
Thank you for your patience on this. At this stage, we could see that the Defect has been waived for Yokohama and Targeted to Zurich.
Will keep you posted as soon as the fix is available.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2025 05:28 AM - edited 03-14-2025 05:28 AM
ServiceNow finally acknowledged that the feature indeed does not work:
KB1699139 + Related Problem: PRB1794568
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1699139
No info on when it'll be fixed though.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2025 03:27 AM
Hi @NS
I can say that for my initial test in a fix script in Zurich patch 0 it works in the global scope
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2024 10:58 PM
I asked about this also from ServiceNow Support. Maybe that will shed some light on the issue. I'm now waiting for them to get back to me, after they said they are also able to reproduce this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2024 11:30 PM
This actually seems VERY inconsistant!
Using a fix script for testing then the conclusion is that const and let works but not even for-of loops works (neither with "let key of arr" nor "var key of arr" - it does work in background scripts using a scoped app.
So this will probably need an extra try from SN 😞
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 01:27 AM
It is consistent. I was also confused at first by reading OP's post but after reading the docs and testing it myself it is work as designed.
Of course you can use ESNext in backgrounds scripts if you run it in a scope. It always worked like this.
What is new: you can now run ESNext in global IF you switch the checkbox on this particular script:
What doesn't work: Running ESNext in a global background scripts. But nowhere does servicenow claim this will be supported. Maybe it will be released for upcoming patches.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 01:33 AM - edited 08-16-2024 01:34 AM
If you have a look at one of the screenshots in my OP, you'll see that the "ES12" toggle is "ON" in my fix script - still the script fails. I don't see how this could be called working or consistent.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 01:59 AM - edited 08-16-2024 02:00 AM
Ah, I see. You found a bug as an early adopter for an upcoming release.
i assumed it was because you didn't run as progress worker (proceed in background) but as a background script (proceed). That is what your screenshot is showing.
i tested it myself and indeed a global Fix Script is not working even as a progress worker and with the ESNext checkbox = true
But I still stand by my previous comment that global background scripts won't work as there's no toggle to run it as ESNext. And this is work as designed.