Enforcing ACLs with GlideAggregate ( similar to GlideRecordSecure )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2018 09:08 AM
Is there a way to enforce ACLs using GlideAggregate in the same way it is done using GlideRecordSecure?
- 2,479 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2018 09:50 AM
Hi Mauricio,
You can use method canCreate()/canWrite()/canRead()/canWrite() to enforce ACL's check. More info here.
https://developer.servicenow.com/app.do#!/api_doc?v=kingston&id=r_ScopedGlideRecordCanCreate
Thanks,
Pradeep Sharma
.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2018 11:07 PM
Can you show me a way to use GlideAggregate with canRead() in order to get an accurate COUNT ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2018 03:14 PM
Hi Mauricio,
Here you go.
var count = new GlideAggregate('u_aggretable'); //Replace u_aggretable with the exact Table Name
count.addAggregate('COUNT');
count.query();
var recount = 0;
if(count.next() && count.canRead())
{
recount = count.getAggregate('COUNT');
gs.addInfoMessage(recount);
}
Thanks,
Pradeep Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2018 06:51 AM
Hi Pradeep
This logic isn't entirely accurate. For example, the CMDB table has many extended tables. Some of those tables may be accessible and others are not accessible. ie: var count = new GlideAggregate('cmdb_ci')
I would like to get a count of the number of records I do have access to. The logic above assumes access is boolean across all records which is not always the case.
Do you have another idea?