Agent Workspace: Highlight VIP user in Agent workspace for interaction table in form view

AKASH BANERJEE
Mega Guru

 

We have a requirement to highlight the VIP users in interaction table in Agent Workspace in form view in servicenow.

Let me know if anyone have any idea on how we can implement that.

I have implemented it in incident and interaction table using the client script and style but not in Agent workspace view.

1 ACCEPTED SOLUTION

Sebas Di Loreto
Kilo Sage
Kilo Sage

Most likely the code you are using on the client script is not good for the workspace environment. 

This code works on all environments.

 

function onChange(control, oldValue, newValue, isLoading) {    
    if (!g_form.hasField('opened_for'))
        return;
    if (!newValue)
        return;
   
    g_form.getReference('opened_for', ref);
    function ref(user) {
        if (user.vip == 'true')
            g_form.showFieldMsg('opened_for', 'This is a VIP user', 'error');
    }
}

 

SebastianDL_0-1670358011185.png

 


If I helped you with your case, please click the Thumb Icon and mark as Correct.


View solution in original post

6 REPLIES 6

Sebas Di Loreto
Kilo Sage
Kilo Sage

Most likely the code you are using on the client script is not good for the workspace environment. 

This code works on all environments.

 

function onChange(control, oldValue, newValue, isLoading) {    
    if (!g_form.hasField('opened_for'))
        return;
    if (!newValue)
        return;
   
    g_form.getReference('opened_for', ref);
    function ref(user) {
        if (user.vip == 'true')
            g_form.showFieldMsg('opened_for', 'This is a VIP user', 'error');
    }
}

 

SebastianDL_0-1670358011185.png

 


If I helped you with your case, please click the Thumb Icon and mark as Correct.


Hi @Sebas Di Loreto ,

 

It is working very fine in Agent workspace but now I am also getting it as an error for the form view when I was not using the Agent workspace.

AKASHBANERJEE_0-1670591308485.png

Is there any further changes that we can do to remove this and only reflect in Agent workspace.

I added this client script on my dev instance and it worked fine on both interfaces, workspace and platform. I attached the xml you can import into the interaction table.

 

SebastianDL_0-1670612511932.png

 

This is how it shows on the platform UI

SebastianDL_2-1670612613465.png

This is how the same interaction shows on the workspace UI

SebastianDL_3-1670612661663.png

 

If you noticed, the client script UI type is ALL. If you want it to apply only to the platform UI then make it Desktop. If you want it on workspace make it Mobile/Service Portal

 


If I helped you with your case, please click the Thumb Icon and mark as Correct.


Hi @Sebas Di Loreto ,

 

Thankyou for the solution.

It is working for me for both platform ui and workspace ui but is there a way in which we can reflect this vip only in workspace ui and remove it from platform ui.