Use reference qualifiers to create filters that restrict the data that is returned for a reference field.
What are types of Reference Qualifier ?
1.> Simple
2.> Dynamic
3.> Advanced
1.> What is Simple Reference qualifier ?
Simple reference qualifiers use AND/OR statements (conditions) to create simple filters.
Ex - Use simple reference qualifiers when filtering on conditions such as whether a company is active, a user has a specific role, and/or a caller is in a specific time zone.
2.> What is Dynamic Reference Qualifier ?
Dynamic reference qualifiers enable you to use a dynamic filter option to run a query against a reference field to filter the returned data set.
Ex- you can add dynamic filter created. In dynamic filter, you can call script include as per your requirement.
Let's implement a real time scenario of Dynamic Reference Qualifier :
Let's show only members who are part of the assignment group in user field for Catalog Item(having two fields assignment group & user) shown below :
Step 1- Navigate to sys_filter_option_dynamic table -
Create new Dynamic filter option with named "GroupMembers"
Step 2 - Call Script Include "GroupMembers" & function "getGrpMembers" in Script field defined below :
Script Include : GroupMembers
var GroupMembers = Class.create(); GroupMembers.prototype = { initialize: function() { },
getGrpMembers: function() {
var GrpU = current.variables.assignment_group_name.sys_id;
var grpMember = new GlideRecord('sys_user_grmember');
grpMember.addQuery('group',GrpU );
grpMember.query();
var userMember= '';
while (grpMember.next()) {
userMember+= ',' +grpMember.user.sys_id; }
return 'sys_idIN' +userMember;
}, type: 'GroupMembers' };
Now, Select Dynamic Reference Qualifier option in Type specification of user field dictionary & add the dynamic filter "GroupMembers" which we have created, image shown below for your reference :
Refer the Reference Qualifier videos on ServiceNow Adda YouTube channel for better understanding link below:
Hope you like my blog, let me know in comment section below ! Stay tuned for new blog.
Comments
Post a Comment