I am having some issues with the javascript trim() function in a Run Script in Workflow and an error is returned whereby the trim() function isn’t reconigned or defined.
It seems the workflow is using a very old version of EECMAScript ? Can you confirm the version?
Also can you confirm whether the Workflow will support TypeScript at some point which now seems to be future of JavaScript?
Workflow uses the version of JScript provided natively by Windows. Unfortunately, Microsoft has not updated their version in years.
We do have plans to implement a different JS engine at some point, one that would be compliant with the more recent versions of EECMASCRIPT, but there are no plans currently to also support TypeScript within Workflow.
In the meantime, you can always modify the String prototype to include the trim() method:
if (!String.prototype.trim) {
String.prototype.trim = function () {
return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
};
}