How to create ACL to restrict visibility of a field so that some users and groups can view this field

Nikita40
Tera Contributor

I want to create an ACL for cmdb_ci_server table so that for a field, for which I need to restrict visibility so some users and groups will be able to see that field. So How can I create script in ACL to add this users and groups ?

Thanks in advance.

1 ACCEPTED SOLUTION

Hi,

So it should be shown when logged in user is member of CAB Approval or that logged in user is present in list of sys_ids in that system property

Is that system property holding multiple user sys_ids with comma separation

then update as this

answer=false;

if(gs.getUser().isMemberOf('CAB Approval') || gs.getProperty('cmdb_ci_server.os.user.visibility').indexOf(gs.getUserID()) > -1 )
{
answer=true;
}
else{
answer=false;
}

Regards
Ankur

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

View solution in original post

25 REPLIES 25

Hi Ankur,

 

Is there a way to achieve this using UI policy or Client Script instead of ACL?

Hi Ankur,

Thank you for your response, this ACL is making read only to users and groups which are mentioned in if condition, but some of other users are still able to see and edit that field. I just want no other user or group wont be able to see this field.

aksh3
Giga Guru

@Nikita :

Hope you are doing good.

Did you get a chance to check on the solution provided to resolve your query?

If your query is resolved please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.

Regards
Akshay

Nikita40
Tera Contributor

Hi Aksh,

I have seen your solution, But I didn't get chance to implement it.

 

Please let me know if you face any issue while implementing the solution. Mark helpful and correct if it helps you.