Updating Count on custom field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 03:43 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 :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 04:10 AM
Have you checked the state, you have added a filter for the state also and might be the present records are not fulfilling the state filter
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 10:15 PM
Hi prince,
Yes its satisfying the condition.
Only the count value is not displaying correctly.