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.

Query using GlideRecord when canRead() returns false

vinuret
Kilo Contributor

Hi,

I have a requirement that a user, irrespective of the role configured in Service now should be able to view any incident details. Currently an Admin or the Incident submitter are able to view the incident.

I tried to query the incident using the below lines

var gr = new GlideRecord('incident');
gr.get('a valid sys_id');
console.log('Incident count: ' + gr.getRowCount()); // this line is printing 0 when the canRead() method returns false (for a user who is neither an admin nor the incident submitter) for the particular Glide record.

Please help me to fix this issue.

Thanks in advance,

Vinu

2 REPLIES 2

SanjivMeher
Mega Patron
Mega Patron

There is an ACL

find_real_file.png

 

 

And then there is a Before business rule on incident. You need to modify both the ACL and BR, to allow all users to read incidents

 

find_real_file.png


Please mark this response as correct or helpful if it assisted you with your question.

vinuret
Kilo Contributor

Thank you so much Sanjiv for the detailed explanation. I will try to implement this and see.