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.

Make record read only when specific assignmend group is assigned

JohnDF
Mega Sage

Hi all,

 

what I need to do that when a record is assigned to the group: Controlling than I want that this group has only read-only access to this record.

 

How can I achieve this requirement?

Thanks for help

5 REPLIES 5

Shubham Singh
Mega Guru

Hi @JohnDF ,

 

You can create a UI policy and use conditions as

Assignment group is not empty

Use the below code in Run Script

var fields = g_form.getEditableFields();
for (var x = 0; x < fields.length; x++) {
g_form.setReadOnly(fields[x], true);
}

 

Thanks!

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up 🙂 

AnveshKumar M
Tera Sage
Tera Sage

Hi @JohnDF 

You can create a write ACL at table level with the following script condition.

 

answer = (!(current.assignment_group.name == 'Controlling' && gs.getUser().isMemberOf('controlling')))

 

Please mark my answer helpful and accept as solution if it helped 👍

Thanks,
Anvesh

@Anvesh thanks for reply.

I did this.

JohnDF_0-1699881391820.png

And than I impersonate the user of the the controlling group if he open a case assgned to this assignment group the caseis still not read only. 

Did I miss something?

@JohnDF 

Can you also try creating another ACL at record level (<tablename>.*)

 

And also check if there are any other ACLs which are allowing the user to have write access.

Thanks,
Anvesh