JSON.stringify() and JSON.parse() seem to break calculated value scripts in RTC. How do I use JSON in calculated values?
Hi
I am tinkering with 'calculated values' in RTC trying to customize the behavior. I thought I'd store information as a JSON object in a 'Large String' custom attribute. However, it seems that as soon as I try to reference any of JavaScripts built in JSON functions the script no longer works. For example, this script does not work. But it does print out "{}" in the console showing that the JSON function works. dojo.provide("test_script"); console.log(JSON.stringify({}));When I comment out the JSON parts it works fine: dojo.provide("test_script"); //console.log(JSON.stringify({})); The behavior is the same regardless of where I reference JSON. 'var a = JSON' anywhere will break it. I do not get any errors when trying this as opposed to if the code contains null references. Has anyone else encountered this problem? Thank you for your time :) |
One answer
After googling for a bit I realized that I needed to import JSON from dojo. The following scripts works:
dojo.provide("test_script"); require(["dojo/json"], function(JSON){ console.log(JSON.stringify({}));I'll Just leave this here in case anyone else has the same problem. |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.