Client script working in UI16 - ITIL view but not in workspaceDescriptionThere is a client script which is trying to clear the caller field on change of another field. Below is the sample script. On change of a custom field we are trying to clear the 'caller_id'. This is working fine on the UI16- ITIL view form, but not on the Agent workspace. function onChange(control, oldValue, newValue, isLoading, isTemplate) { if (isLoading || newValue === '') { return; } var ga = new GlideAjax('GetAccountDetails'); ga.addParam('sysparm_name', 'getAccount'); ga.addParam('sysparm_fieldID', g_form.getValue('u_customField')); ga.getXML(populateAssn); function populateAssn(response) { var answer = response.responseXML.documentElement.getAttribute('answer'); var oldFieldValue = g_form.getValue('company'); if (oldFieldValue != answer) { g_form.setValue('company', answer); // var clr = g_form.getReference('caller_id'); //Commenting this //Get the caller object so we can access fields var caller = g_form.getReference('caller_id', callBack); g_form.clearValue('caller_id'); } } }CauseThis issue is happening because of using the getReference() API without any callback function in the onChange Client Script. We need to use a callback function for getReference() method instead to make it work on Agent workspace/Service Portal:ResolutionReplace the script with below: =================================================================== function onChange(control, oldValue, newValue, isLoading, isTemplate) {if (isLoading || newValue === '') {return;}var ga = new GlideAjax('GetAccountDetails');ga.addParam('sysparm_name', 'getAccount');ga.addParam('sysparm_fieldID', g_form.getValue('u_customField'));ga.getXML(populateAssn);function populateAssn(response) {var answer = response.responseXML.documentElement.getAttribute('answer');var oldFieldValue = g_form.getValue('company');if (oldFieldValue != answer) {g_form.setValue('company', answer);// var clr = g_form.getReference('caller_id'); //Commenting this//Get the caller object so we can access fieldsvar caller = g_form.getReference('caller_id', callBack);//Nested 'getReference' callback function for variable accessfunction callBack(caller) {if (oldFieldValue == caller.company) {alert('inside');g_form.clearValue('caller_id');}}}}}=================================================================== Now, the Caller field is cleared as expected in Agent Workspace as well. Reference: https://community.servicenow.com/community?id=community_question&sys_id=5eb2377edbf57bc0d58ea345ca9619c4 https://community.servicenow.com/community?id=community_question&sys_id=a78c62e3db29e300107d5583ca9619f7