Is client scripts, UI policies etc supported in Agent Workspace

Rolf Nyhus
Tera Guru

Does anyone know if there is support for client scripts, UI policies etc in Agent Workspace?

E.g. I have an onchange client script that automatically populates Business Service based on chosen Service Offering. This works fine in normal Incident form view. However, in Agent Workspace there is no update to Business Service when I select a Service Offering.

1 ACCEPTED SOLUTION

Hi Göran,

Yes, I tried to do a fast fix using GR instead of GA. Looks like you're right about GR not being supported client side in the Workspace. I converted to GA and now it works.

Thanks for your help!

Just another question, a bit on a tangent, do you know if there is a way to get form sections to appear as tabs in the workspace? The "Details" tab quickly becomes very lenghty...

 

Rolf

View solution in original post

6 REPLIES 6

Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

Hi Rolf,

 

They should work, but there are a few limitations that it might be. First check on client script if for example that you have UI Type to "all" or "Mobile / Service Portal".

Otherwise throw in the code here and we can see if there is something there.

 

//Göran

Hi Göran,

Here is the client script. It is onChange and UI type is All.

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
 if (isLoading){
  return;
 }

 //Type appropriate comment here, and begin script below
 //Clear values if Service Offering field is blanked
 if (newValue === ''){
  g_form.clearValue('business_service');
  g_form.clearValue('assignment_group');
  return;
 }
 
 //Set Business Service and Assignment Group based on selected Service Offering
 var gr = new GlideRecord('service_offering');
 gr.get(newValue);
 g_form.setValue('business_service', gr.parent);
 g_form.setValue('assignment_group', gr.support_group);
}

Hi Rolf,

you shouldn't do GlideRecord query in a client script. If you want to have information from the server, you should do a GlideAjax call (GlideAjax - Client | ServiceNow Docs). It has been possible to do this in the client script even if it isn't recommended and they might have removed that option on the workspace, I honestly don't know about that one since you shouldn't do it anyway. Here is also an example video how to do glideAjax call in a client script that I did for quite a while ago: https://www.youtube.com/watch?v=p5F3lpXgkHk

If you got my book, I also have it covered in there.

//Göran
Feel free to connect:
LinkedIn
Subscribe to my YouTube Channel
or look at my Book: The Witch Doctor’s Guide To ServiceNow

Hi Göran,

Yes, I tried to do a fast fix using GR instead of GA. Looks like you're right about GR not being supported client side in the Workspace. I converted to GA and now it works.

Thanks for your help!

Just another question, a bit on a tangent, do you know if there is a way to get form sections to appear as tabs in the workspace? The "Details" tab quickly becomes very lenghty...

 

Rolf