- 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 11:04 PM
Agree Jon, we should go with a Business rule, But i have seen the cases where we have to clear the any field on change of something, sothat user need not to clear it manually and he can fill the information in string field.
Regards
Ujjawal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2018 06:22 AM
Yes definitely! I have had that use case many times too. I just wanted to remind the original poster to still do the BR even if he does the client script for that reason.
thanks