Field level ACLs creation options

EshikaAgrawal
ServiceNow Employee
ServiceNow Employee

I have field-level ACLs defined on a table, and I noticed entries like tablename.* exist for read and write operations. Initially, I used GlideRecordSecure in my script to rely on built-in ACL enforcement.

 

However, I observed that GlideRecordSecure can result in unexpected behavior during operations like insert() or update() — for example, if the user lacks access to some fields, only a partial insert may happen (i.e., some fields are saved while others are silently skipped). This is not desirable, as it leads to inconsistent data.

To ensure strict enforcement of field-level permissions, it's better to explicitly validate field access and throw an error if the user doesn't have permission to access any of the required fields — instead of proceeding with incomplete data.

 

While we can use isValidField() to check field access or gr.getElement(fieldname).canRead(), calling it for each field individually becomes tedious. Even if we centralize this in a helper method and pass a list of field names, we still have to maintain that list for all usage points, which is error-prone and difficult to scale.

 

Any other way to handle this?

8 REPLIES 8

Hi @Ankur Bawiskar ,

 using gliderecordsecure id field's value always gets returned? doesn't matter if it respects acl or not? i have observed this for few tables

@EshikaAgrawal 

GlideRecordSecure I believe is only for record and not for field

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar 

I have verified this , for the fields not accessible, it's returning null/default value except id

@EshikaAgrawal 

So my above guess is correct.

In that case you cannot use GlideRecordSecure for field access check

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader