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 can we restrict reference field values?

UdbhavS
Tera Contributor

In the incident form there is a reference field configuration items, which when open from incident form then we can see 3000+ CIs. How can we make it in such a way that for users with not admin role should be able to see only those CIs whose class is Computer only?

 

I tried the below query in the reference qualifier but it didn't work. 

Reference field : Configuration item

Use reference qualifier : advanced

 

javascript:
var answer = '';
if(gs.hasRole('admin')){
answer = 'sys_class_nameISNOTEMPTY';
}
else{
answer = 'sys_class_name=cmdb_ci_computer';
}
return answer;

1 REPLY 1

Bert_c1
Kilo Patron

try a Business Rule that runs 'Before' and for 'Query'. use your logic there, easy to debug.