how to write the script in the acl to check the user is admin

lakng
Tera Contributor

here my requuiremnt is to restrict the users who are having the itil role to not to edit the state fields of catalog tasks on list view when the state is in closed state.

i wants script to put in the acl to check the user role 

when the user is admin, this conditions should not work,

if the user is not admin the given conditions should work.

3 REPLIES 3

akumarsst
Tera Contributor

Hello,

 

You can have a write acl on state field and use gs.hasRole("admin") in the script or you can give the role admin under Require roles section;

 

Elijah Aromola
Mega Sage

The following script will check if the user is Admin and deny/grant access.

if(gs.hasRole('admin')) {
	answer = false;
} else {
	answer = true;
}

Please mark this as helpful/correct if it resolved your issue!

Mark Roethof
Tera Patron
Tera Patron

Hi there,

How does your write ACL look like now?

I don't think you need a scripted ACL. For example, a write ACL with condition state is not Closed [or just active=true]+ in the Role list just select ITIL. For admins having write access, just check the checkbox admin overrides.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn