- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-19-2022 10:16 PM
Hi Team,
I have a reference field(group) if group is selected it auto populate the group manager in another string field. I need to check two condition in String field.
1. After populating the group manager, if Group manager is inactive then need to make one check box mandatory and show field message in string field.
2. If Group manager is not present in group table, will get empty string field, then need to make same check box mandatory and show field message in string field.
I wrote the onchange client script for string field
function onChange(control, oldValue, newValue, isLoading) {
var caller = g_form.getReference('group_owner_dl', doAlert); // doAlert is our callback function
var grp = g_form.getValue('group_owner_dl');
function doAlert(caller) { //reference is passed into callback as first arguments
if ((caller.active == 'false') && (grp != ""))
{
g_form.showFieldMsg('group_owner_dl', 'Group Owner is inactive. Please Add new group owner');
g_form.setMandatory('change_group_owner', true);
}
else if ((grp == "") && (group_to_be_modified_dl)) {
g_form.showFieldMsg('group_owner_dl', 'Group Owner is Empty. Please Add new group owner');
g_form.setMandatory('change_group_owner', true);
}
else
{
g_form.hideFieldMsg('group_owner_dl', false);
g_form.setMandatory('change_group_owner', false);
}
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-19-2022 11:16 PM
you cannot dot walk to 2 levels in client script so you need to use GlideAjax to know manager is inactive or not
Do all the logic in script include function and in client side just add the message and mandatory logic
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-19-2022 11:16 PM
you cannot dot walk to 2 levels in client script so you need to use GlideAjax to know manager is inactive or not
Do all the logic in script include function and in client side just add the message and mandatory logic
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader