GlideRecord Vs GlideRecordSecure

Shankar19
ServiceNow Employee
ServiceNow Employee

HI,

In terms of performance, which is best practice to use?

GlideRecordSecure or GlideRecord with canRead?

Thanks

1 ACCEPTED SOLUTION

Rajeev Jayaswal
ServiceNow Employee
ServiceNow Employee

I see multiple answers to this question, but none of them discuss the GlideRecord() method with the canRead() method. 

 

If we use GlideRecordSecure(), it evaluates all ACLs (read/write/create/delete/etc.), so the overall execution time is relatively higher. 

 

With the GlideRecord() and canRead() method, it doesn't need to evaluate all ACLs here. If we are using canRead(), then only READ ACL will be evaluated, which skips other ACLs. 

So with GlideRecord() & canRead(), we will be able to achieve both security and performance (to some extent only), so better to use this one. 

 

 

 

 

View solution in original post

5 REPLIES 5

Rajeev Jayaswal
ServiceNow Employee
ServiceNow Employee

I see multiple answers to this question, but none of them discuss the GlideRecord() method with the canRead() method. 

 

If we use GlideRecordSecure(), it evaluates all ACLs (read/write/create/delete/etc.), so the overall execution time is relatively higher. 

 

With the GlideRecord() and canRead() method, it doesn't need to evaluate all ACLs here. If we are using canRead(), then only READ ACL will be evaluated, which skips other ACLs. 

So with GlideRecord() & canRead(), we will be able to achieve both security and performance (to some extent only), so better to use this one.