Client script not working in Agent workspace but works in Platform view

Kamy
Tera Contributor

I have a issue where the onChange script that I am using is trying to find a difference between two fields and populates the value in the third field. It is working in the Platform view but is not working on the agent workspace. Below is the onChange script logic that I have that is working fine in the platform view but not in agent workspace.

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

var amt = parseInt(g_form.getValue('amt1').substring(4)) - parseInt(g_form.getValue('amt2').substring(4));
g_form.setValue('amt3', 'USD;'+amt);

}

So here we are taking the difference between amt1 and amt2 and setting it to amt3. Not sure why this is not working in agent workspace.

I am getting a negative value of what we enter in amt2 field as a result in amt3 field instead of the different between amt1 and amt2 fields. 

Any inputs would be appreciated. Thank you!

7 REPLIES 7

Ravi9
ServiceNow Employee
ServiceNow Employee

see if this helps

Kamy
Tera Contributor
Hi Ravi, the isolate script box is check marked and is true for this script. Still doesn’t work.

Harshal Gawali
Giga Guru

Hi Kamy,

In your client script uncheck global checkbox & select view name as "agent_workspace" then it will work in agent workspace view.

Regards,

Harshal.

Hi Harshal,

I tried that. It is not working.