OL Learn

Escape characters in runtime parameters

I’ve noticed an issue where the runtime parameters passed to the Execute Data Mapping step are parsed by workflow and then seemingly parsed again during the JSON handover as any backslashes are removed.

For example:

  • I set a runtime parameter in Execute Data Mapping called filePath and set it’s value to a local workflow variable: %{path}
  • In the workflow log, I can see it go through and get parsed correctly:

Datamapping Runtime Parameters JSON: {“parameters”:{“filePath”:"%{path}"}}
Parsed Datamapping Job Runtime Parameters JSON: {“parameters”:{“filePath”:“D:\Data\Temp”}}

But for some reason, my resource wasn’t pulling through to the Connect template, so I decided to drop it onto the template as a printed string and it showed the following: -

Test runtime parameter: D:ataemp

So clearly, once it gets to the template, the JavaScript parser is reading the backslashes as escape characters and escaping the following chars instead of reading it as a literal string.

This isn’t at all clear from the logs as it goes into the plugin fine but goes wrong inside the template - the logic makes sense from the standpoint of parsing in JS but not from a presentation standpoint where the Parsed Datamapping Job Runtime Parameters JSON should show the literal string that the template will have for use.

I can get around it by escaping the backslashes with another in the variables just before going through the plugin but this won’t be clear to many.

Let me know if I am missing anything.

EDIT: Just found this topic - seems I have found the same bug. Good to know it’s known about.
How to use runtime parameter in job preset

Regards,

James.

1 Like

This was fixed in version 2020.2

2 Likes