Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

g_form.clearValue not working correctly

caoh
Giga Expert

We have a catalog item. In its on‑submit client script, we clear the value of one variable on the request form when a certain condition is met, using the statement: `g_form.clearValue('var1');

` Note: This variable is of type **Lookup Select Box**, and the *Include none* option is unchecked.

 

This logic worked correctly and cleared the variable value for several years. After applying the patch `glide‑zurich‑07‑01‑2025__patch9‑hotfix1`, the value can no longer be cleared by this process.

※ Before applying this patch, the value of this variable obtained from *Get Catalog Variables* in the flow was empty.

※ After applying the patch, the value obtained from *Get Catalog Variables* within the flow is no longer empty.

 

Is this behavior caused by a specification change in the Zurich release, or is it a bug?

1 ACCEPTED SOLUTION

Thank you for your answer. We have confirmed that the clearvalue logic executes before the form is being submitted.

 

We modified `g_form.clearValue('var1')` to `g_form.setValue('var1', '')`, and now it functions normally as it did before applying the Zurich patch.

 

View solution in original post

2 REPLIES 2

Hemanth M
Tera Sage

Hi @caoh ,

 

Did you debug the onSubmit client script to see what's happening? It could be a scenario where the form is being submitted before the clearvalue logic executes.

 

 

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025,2026

Thank you for your answer. We have confirmed that the clearvalue logic executes before the form is being submitted.

 

We modified `g_form.clearValue('var1')` to `g_form.setValue('var1', '')`, and now it functions normally as it did before applying the Zurich patch.