Clear value when field is hidden
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2024 05:44 AM
Hi,
I have a field that is hidden when the checkbox of another table is set to true.
And now I want this field to be clear whenever is hidden.
So far I have a UI policy with the following script set to true
function onCondition() {
if (!g_form.isVisible('u_model_details')) {
g_form.clearValue('u_model_details'); // Clear the field value
return true;
}
return false;
}
And the UI policy action clear the field value set to true, but is not working properly.
Any ideas??
Thank you and best regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2024 05:54 AM
Hi @Samuel Moya cam ,
Use below code instead of "isVisible" you can use "isFieldVisible".
function onCondition() {
if (!g_form.isFieldVisible('u_model_details')) {
g_form.clearValue('u_model_details'); // Clear the field value
return true;
}
return false;
}
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------