- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2018 06:57 PM
Hi ServiceNow Gurus,
In have 2 fields:
u_field_a is a text field, u_field_b is a true/false field
by default, u_field_a contains a value (ex. "string") and u_field_b is true
what i want to achieve is to clear u_field_a when u_field_b is set to false.
please help.
thank you very much.
Carlo
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2018 07:52 PM
Hi Carlo,
You can also use onChange client script for field u_field_b if you want to clear the field a as soon as we change the field b to true.Please refer screenshot below.
script-----
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(newValue=='false')
g_form.setValue('u_field_a','');
}
Hope this helps.
Regards
Ujjawal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2018 07:04 PM
You can create a new Business rule for this. You can do it without scripting.
Set the Filter Condition in your BR to u_field_b Changes to false
In the Actions tab, use set Field Values to set u_field_a to blank.
Tick the insert and update boxes and save your BR. this should give you what you want.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2018 07:52 PM
Hi Carlo,
You can also use onChange client script for field u_field_b if you want to clear the field a as soon as we change the field b to true.Please refer screenshot below.
script-----
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(newValue=='false')
g_form.setValue('u_field_a','');
}
Hope this helps.
Regards
Ujjawal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2018 09:48 PM
thanks! this is exactly my code except my "false" was not inside ''.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2018 10:45 PM