- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi All,
I have been tasked with creating an alert (or not) on load and on change.
Under the Restaurant Field:
I would like an alert that references another field in the Location information. I have the following:
I'm not trained in SNow and pretty much wing it with the help of community articles and google, but this time i cannot see a solution.
thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
if u_choice_3 is a field in the table being referred by Restaurant field then this script will work
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
g_form.hideFieldMsg('u_restaurant');
var ref = g_form.getReference('u_restaurant', callBackMethod);
}
function callBackMethod(ref) {
if (ref.u_choice_3)
g_form.showFieldMsg('u_restaurant', 'Current Trial:' + ' ' + ref.u_choice_3, 'info');
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
May you try this
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || !newValue) {
return;
}
var trialValue = g_form.getValue('u_choice_3');
g_form.clearMessages();
g_form.showFieldMsg('u_restaurant', 'Current Trial: ' + trialValue, 'info');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
thanks for the prompt reply, This unfortunately returned nothing.
maybe i should have mentioned the U_Restaurant field on the Incident table references the 'location' table. U_Choice_3 is a field in the location table:
I edited your script to return just the u_Restaurant field (I figured if i could get it to mimic the restaurant field i could work from there)
var trialValue = g_form.getValue('u_Restaurant');
and the message returned:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
if u_choice_3 is a field in the table being referred by Restaurant field then this script will work
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
g_form.hideFieldMsg('u_restaurant');
var ref = g_form.getReference('u_restaurant', callBackMethod);
}
function callBackMethod(ref) {
if (ref.u_choice_3)
g_form.showFieldMsg('u_restaurant', 'Current Trial:' + ' ' + ref.u_choice_3, 'info');
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
My hero