Notifications

19 views

Description

On Service Portal the setValue function does not change a variable when combined with showFieldMsg/showErrorBox, when the onChange client script variable is the one having its value set and messages displayed.

The issue occurs when there are multiple g_form methods/functions run on the same field in an onChange catalog client script. 


Issue does not occur on Platform.

Steps to Reproduce

  1. On a catalog item create a new variable set
    2. Add a single line text variable to the VS (field1)
    3. Add a second single line text variable to the VS (field2)
    4. Add an onChange Catalog client script to the VS on field2
    5. Enter in the following script (regex condition removed for troubleshooting)
    g_form.setValue('field1','555');
    g_form.setValue('field2','777');
    //g_form.showFieldMsg('field2',"Please enter a valid integer");
    //g_form.showErrorBox('field2',"Please enter a valid integer");
    6. Open the form in Portal
    7. Enter data in field1 and field2 then lose focus and both fields will change
    8. Uncomment the ShowFieldMsg and repeat step 7 -

Actual behavior:

field2 value will not change. field message can be seen


Expected behavior:

field2 value changes. field message can be seen

Workaround

If you are only having issues displaying messages, then g_form.addErrorMessage and/or g_form.addInfoMessage can be used. e.g.

Instead of 

[code]<pre>

g_form.setValue('field2','777');
g_form.showFieldMsg('field2',"Please enter a valid integer");

</pre>[/code]

Use

[code]<pre>

g_form.addErrorMessage("Please enter a valid integer");

g_form.setValue('field2','777');

</pre>[/code]

 


Related Problem: PRB1306928

Seen In

There is no data to report.

Intended Fix Version

Madrid

Safe Harbor Statement

This "Intended Fix Version" information is meant to outline ServiceNow's general product direction and should not be relied upon in making a purchasing decision. The information provided here is for information purposes only and may not be incorporated into any contract. It is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. The development, release, and timing of any features or functionality described for our products remains at ServiceNow's sole discretion.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-11-13 17:28:05
Published:2018-11-08