getRowCount - alm_license
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2024 10:37 PM - edited 08-02-2024 04:51 AM
I created a new field in the alm_license form called "u_usage" and executed a business rule to calculate the total count of devices and user entitlements. However, I do not see the value in my field. Could you please advise on what went wrong?
Table: alm_license
When to run: Insert and Update
(function calculatedFieldValue(current) {
// Use GlideAggregate to count the number of matching records
var ga = new GlideAggregate('alm_entitlement');
ga.addQuery('licensed_by', current.sys_id);
ga.addAggregate('COUNT');
ga.query();
if (ga.next()) {
return ga.getAggregate('COUNT');
}
return 0;
})(current);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2024 08:32 AM
Is your business rule running before or after?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2024 01:33 AM
I tried it all, but only Display works. Even though I obtained the value in the form view, it didn't set in the field. I tried manually saving it, but in the list view, it still shows zero. So I changed the approach to have it populated in the Dictionary calculated value script.