Loading...
Loading...
Choice fields are updated incorrectly in scoped applications and are the labels are shown in decimal values like 1.0, 3.0 when they are updated using UI Actions/any Server script.
Any instance: 1. Create a Scoped app 2. Create a Scoped table 3. Create a 'Choice' type field 4. Add a new 'sys_choice' record for this choice field whose value is 1. Run the below script in scripts-background module by choosing the scope the Run script in scope as 'x_snc_scoped_app_u' var gr = new GlideRecord('x_snc_scoped_app_u_ux_choice'); gr.initialize(); gr.u_my_choice = 1; gs.info(gr.u_my_choice); Expected behavior: The script output should be 1 Actual behavior: The script output is 1.0, a decimal representation of 1.
Set the scoped application's JavaScript Mode on the Application Settings (sys_app record for the application) to "Compatibility" or set the Choice field (which is an extension of the String type) using string values, and not a numeric value. Using the above example that would be: var gr = new GlideRecord('x_snc_scoped_app_u_ux_choice'); gr.initialize(); gr.u_my_choice = "1"; gs.info(gr.u_my_choice); This avoids the type conversion which is ES5 Standard Mode is resulting in the integer value being converted to a decimal string value.
PRB1399003
Click on a version to see all relevant bugs
ServiceNow Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.