Updating a custom field value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 12:50 AM - edited 08-02-2023 12:53 AM
Hi,
I have a requirement where 'Assigned User' is a field on a custom table.
Whenever the assigned value changes 'TCL' is a string field and the count should be updated with the count of all records that are assigned to 'Assigned User'.
Have configured the below client script and script include. But it isnt working as expected. Can someone correct me.
Client script - onChange Client script
var reqFr = new GlideAjax('TestScript');
reqFr.addParam('sysparm_name', 'orderCount');
reqFr.addParam('sysparm_reqfor', newValue);
reqFr.addParam('sysparm_state', g_form.getValue('state'));
reqFr.getXML(getOrderValue);
function getOrderValue(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.setValue('TCL', answer);
}
}
Script Include :