Glide Record check user satisfies the user criteria

Tadz
Tera Guru
Tera Guru

Hi Everyone,

Is it possible to add user criteria as a query in a GlideRecord?

Lets say, i want to display a knowledge base articles on the portal.

And some articles have user criteria.

I want my gliderecord to return only items that the user has access to.

 

Thanks,

Tadz

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

when user visits the articles page he/she sees only those for which the user criteria is satisfied.

Why to check which user criteria s are satisfying

please check below link:

https://community.servicenow.com/community?id=community_question&sys_id=27bc4d44db616b04b1b102d5ca96...

Regards
Ankur

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

Hi Ankur, user criteria is working fine if they click the article.

But in my current query it would get all knowledge articles even though user did not satisfy the user critieria of the record. 

I'm finding a way to display only articles that the user has access to.

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,

User criteria is meant for showing or hiding the article. Which Query you want, you can script in script field on user criteria. 

 

Ex:

find_real_file.png

 

Thanks,
Ashutosh

Jaspal Singh
Mega Patron
Mega Patron

If I understand you need to pass script in usercriteria that uses GlideRecord for logged in  user.

If so, something as below should help.

answer=catItemRestriction();
function catItemRestriction(){
	var gettitle=gs.getUser().getRecord().getValue('title');//gets title for logged in user from usertable
	if(gettitle== 'Your title')
		{
		 return true;
	}
	else
		{
		return false;
	}
}