- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2023 07:42 AM
On an interaction, I have a field name 'u_external_user'. It is a checkbox (True/False).
I want to toggle this field True if the Opened for field 'opened_for' is a user named External User. I believe a client script will be the best way to do this but need advice on this and code if anyone can help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2023 05:12 AM
if(g_form.getValue("opened_for") == "sys id of the external user)
{
g_form.setValue("<external_user_checkbox" , true);
}
else
{
g_form.setValue("<external_user_checkbox" , false);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2023 09:16 PM
@Community Alums you can check this above code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2023 08:40 AM
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ref = g_form.getDisplayBox('<opened for>').value;
if(ref=='External User'){
g_form.setValue('u_external_user', true);
}
else g_form.setValue('u_external_user', false);
}
}
}
@Community Alums check this out if it helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2023 05:07 AM
I tried this one also. It will not set the field value to true. I did update the field name to opened_for.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2023 12:48 PM
Can you help with this code for the incident form?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2023 01:28 AM
Hi @Community Alums
It can be done via UI Policy.
I created it for Incident table,
You can any of condition,
if external user flag is true or external user name is :
Do the UI action
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************