Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

ACL script

Selva Arun
Mega Sage
Mega Sage

Hi All, I have a requirement where only support group members should be able to edit records on the application(cmdb_ci_appl) table. I'm getting lost while writing the script on the ACL as I'm still learning to code. Can anyone help me with the script, please? Thank you.

5 REPLIES 5

Selva Arun
Mega Sage
Mega Sage

Hi All, 

thank you for all the replies, have tried below script, looks like it is not working for some of the records:

if(gs.getUser().isMemberOf(current.support_group.name))

answer=true;

 

It did work on the form level using the below, but im looking to restrict both on form level and list view.

 

only Support Group Members have editing privileges
 
// create a  Display Business Rule for checking the group
(function executeRule(current, previous /*null when async*/) {
 
g_scratchpad.isMember = gs.getUser().isMemberOf(current.support_group.name);
 
})(current, previous);
 
// create a onload client script: Restriction only to Support Group Member
 
function onLoad() {
    if (g_scratchpad.isMember.toString() !== 'true') {
        var fields = g_form.getEditableFields();
        for (var x = 0; x < fields.length; x++) {
            g_form.setReadOnly(fields[x], true);
        }
Please help
    }
}