
- 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-14-2023 06:00 AM
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (g_form.getDisplayBox('opened_for').value) == 'External User';
{
g_form.setValue('u_external_user', true); //when caller is external user
}
else {
g_form.setValue('u_external_user', false); //when caller is NOT external user
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2023 07:57 AM
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var userDisplay = g_form.getDisplayBox('opened_for').value
if (userDisplay == 'External User')
{
g_form.setValue('u_external_user', true); //when caller is external user
}
else {
g_form.setValue('u_external_user', false); //when caller is NOT external user
}
This code works in Platform view but not in Service Operations Workspace which is where it will predominantly be used.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2023 07:59 AM
This code works in Platform view but not in Service Operations Workspace which is where the users live most of the time.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var userDisplay = g_form.getDisplayBox('opened_for').value
if (userDisplay == 'External User')
{
g_form.setValue('u_external_user', true); //when caller is external user
}
else {
g_form.setValue('u_external_user', false); //when caller is NOT external user
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2023 08:25 AM
Have you tri4ed to add alerts to check on workspace what is not working.
Alert userDisplay and see if you get desired value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2023 04:33 AM
@Community Alums getDisplayBox won't work in the workspace side, you have to use either getReference or GlideAjax to fetch the value.
Please find below sample code for getReference:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var user = g_form.getReference('opened_for', findUserDisplay);
function findUserDisplay(user) {
if (user.name == 'External User')
g_form.setValue('u_external_user', true);
else g_form.setValue('u_external_user', false);
}
}