UI policy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
i want to make a ui policy if the shortdescription contains some numbers a field should be visible i have hundred numbers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
hi @mayanksinghrath ,
you can write script in UI policy to make visibility of field depending on number present in short description field like
in UI policy
When to apply make condition like this Short description is not empty
Go to Script tab and check the "Run scripts" checkbox (if not visible, make sure you are in advance view)
Then in script section(Execute if true), you can try something like this
function onCondition() {
var shortDesc = g_form.getValue('short_description');
// Regex to check if any digit exists
if (/\d/.test(shortDesc)) {
g_form.setDisplay('your_field_name', true);
} else {
g_form.setDisplay('your_field_name', false);
}
}
Thanks,
BK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
so what did you start with and where are you stuck?
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader