- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2021 05:38 AM
On incident form: when user with VIP = true is selected as caller in the incident, then addFielMessage to Caller field saying “This user is VIP”. Remove the message if Caller is changed then to empty or not VIP
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2021 06:26 AM
update as this and check once
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
g_form.hideFieldMsg('caller_id');
//Type appropriate comment here, and begin script below
g_form.getReference('caller_id', function(gr) {
if (gr.vip.toString() == 'true') {
g_form.showFieldMsg('caller_id', 'caller is VIP', 'info');
}
});
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2021 05:44 AM
Hello @Emmanuel
Have you tried anything so far?
It will be helpful and learning for you
Thanks,
Murthy
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2021 06:18 AM
This is what i tried
// function onChange(control, oldValue, newValue, isLoading, isTemplate) {
// if (isLoading || newValue === '') {
// return;
// }
// //Type appropriate comment here, and begin script below
// var caller = g_form.getReference('caller_id');
// if (caller.vip == 'true'){
// g_form.showFieldMsg('caller','This user is VIP','info');
// }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2021 05:46 AM
Hi,
Try the below script.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
g_form.hideFieldMsg();
return;
}
//Type appropriate comment here, and begin script below
g_form.getReference('caller_id', function(gr) {
if (gr.vip == true) {
g_form.showFieldMsg('caller_id', 'caller is VIP', 'info');
} else {
g_form.hideFieldMsg();
}
});
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2021 06:20 AM