- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 05:15 AM - edited 09-13-2023 05:16 AM
Hello,
I have a requirement that is, we have field called 'SHOW'(Reference field) in incident form. If the user selects 'Primer Impacto' show then 'example@test.com' user should be autopopulate in Watchlist. Attached screenshot
Can anyone please suggest the script to achieve this.
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 05:46 AM
your script is wrong.
do this
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
var val = g_form.getDisplayBox('u_show').value; // give here the field name
// give here correct choice values
if (val == "Primer Impacto") {
g_form.setValue('watch_list', 'sysIdOfUser'); // give here the sys_id of the user you want to set in watch list
}
}
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
09-13-2023 05:20 AM
so you need to write onChange client script.
where are you stuck?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 05:38 AM
Attached screenshot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 05:46 AM
your script is wrong.
do this
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
var val = g_form.getDisplayBox('u_show').value; // give here the field name
// give here correct choice values
if (val == "Primer Impacto") {
g_form.setValue('watch_list', 'sysIdOfUser'); // give here the sys_id of the user you want to set in watch list
}
}
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