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.

How to restrict access to records based on a condition?

SNOW Developer6
Tera Contributor

Hi,

I want to restrict access to records and want the user only see the records where he is requester.

requester is a reference field from another table.

I tried doing it via read ACL and given following condition = but its not working

answer = false;
var gr = new GlideRecord('tablename');
gr.addQuery('requester',gs.getUserID());
gr.query();
while(gr.next())
	{
		answer = true;
	}

I want to show the only records where the user is requester.

 

Can you please suggest how to do it?

 

 

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

Use this as the script on ACL

answer = false;

if(current.requester == gs.getUserID();
{
	answer = true;
}

-Anurag

-Anurag

View solution in original post

1 REPLY 1

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

Use this as the script on ACL

answer = false;

if(current.requester == gs.getUserID();
{
	answer = true;
}

-Anurag

-Anurag