The CreatorCon Call for Content is officially open! Get started here.

How to Avoid GlideRecord in ACL

Snehal13
Kilo Sage

I have an ACL on sc_req_item table as below to allow read access to the RITM for sc task approvers.

How to remove GlideRecord usage in ACL and replace with ACL conditions so that it still grants read access to the RITM and variables on it for sc task approvers

 

 

 

    var app_obj = new GlideRecord('sysapproval_approver');
    app_obj.addQuery('approver', gs.getUserID());
    app_obj.addQuery('sysapproval', current.sys_id);
    app_obj.query();
    if (app_obj.next()) {
        return true;
    }
    return false;

 

 

 

8 REPLIES 8

I did but the ask is not to move to script include and only way left is to do with ACL conditions

@Snehal13 

then not possible directly.

Use this approach

1) create custom field of type List referring to sys_user

2) store the approvers of that RITM in it

3) then use this in ACL condition

AnkurBawiskar_0-1759932420434.png

 

💡 If my response helped, please mark it as correct ✔️ and close the thread 🔒 — this helps future readers find the solution faster! 🙏

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

@Snehal13 what is datatype of ?

current.request.approvers

you can verify with below code.

(function() {
answer = false;

// Ensure we have a parent request and an approvers list
if (current.request && current.request.approvers) {
var approvers = current.request.approvers + ''; // force to string
if (approvers.split(',').indexOf(gs.getUserID()) > -1) {
answer = true;
}
}
})();

tried but didnt work