Client Script not working in Workspace

Naveen Kumar
Tera Contributor
 
 
g_form.getDisplayBox('opened_for').style.color = 'red';
 
The above script is working in platform but not working in workspace.
NaveenKumar_0-1699857621071.pngNaveenKumar_1-1699857667281.png

 

 
 
I am writing some alerts and these alerts are coming in the workspace also but not setting the color.
 
 
 
 
 
 
 
 
 
 
 
if (user.vip == true || user.vip == 'true')
                {
                    alert("inside = vip");
                    g_form.getDisplayBox('opened_for').style.color = 'red';

                }
                else if(user.u_exec == true || user.u_exec == 'true')
                {
                    alert("inside - exec");
                g_form.getDisplayBox('opened_for').style.color = 'purple';
                }
1 REPLY 1

yaswanthi2
Giga Sage

Hi @Naveen Kumar  

If you want it on workspace make UI type as it Mobile/Service Portal. try below code

function onChange(control, oldValue, newValue, isLoading) { 
if (!g_form.hasField('opened_for'))
return;
if (!newValue)
return;

g_form.getReference('opened_for', VIPUser);
function VIPUser(user) {
if (user.vip == 'true')
g_form.showFieldMsg('opened_for', 'This is a VIP user', 'error');
}
}

 If that helps please mark my answer as correct / helpful!

Regards,

Yaswanthi