https://developer.servicenow.com/blog.do?p=/post/gliderecord-vs-gliderecordsecure/
GlideRecord performs get/create/update operations to DB without concern of permission.
Best practice is to call canRead(), canWrite(), canDelete() and canCreate() functions when need permission
GlideRecordSecure checks permisssion on its on before performing get/create/update operations to DB
GlideRecord Query with Access Check
var catSysIds = getCatSysIds();
function getCatSysIds() {
var cats = [];
var catData = new GlideRecord("x_abc_britt_app.cat_data");
catData.query();
while (catData.next()) {
if (!catData.canRead()) {
continue;
}
cats.push(catData.getUniqueValue());
}
return cats;
}
GlideRecordSecure Query (Access Check Built In)
var catSysIds = getCatSysIds();
function getCatSysIds() {
var cats = [];
var catData = new GlideRecordSecure("x_abc_britt_app.cat_data");
catData.query();
while (catData.next()) {
cats.push(catData.getUniqueValue());
}
return cats;
}
No comments:
Post a Comment