- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2022 02:25 AM
Hi all,
In Resource Plan module, I would like to display Groups in lookup list that tag to certain country(for eg : Malaysia) to be display in the list. I have created choice list field country in Group table (sys_user_group) so that I will able to filter that in the list. Kindly, please help.
Current filter for the Groups is as below:
Thanks and Regards,
Natalia
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2022 02:32 AM
Hi,
So is the current ref qualifier OOB and you wish to add one more condition to it?
if yes then do this; ensure you give correct choice value for country
javascript: 'Existing Condition' + '^u_country=Malaysia';
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2022 02:32 AM
Hi,
So is the current ref qualifier OOB and you wish to add one more condition to it?
if yes then do this; ensure you give correct choice value for country
javascript: 'Existing Condition' + '^u_country=Malaysia';
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2022 04:52 AM
Hi Ankur,
I have tried this and it works fine. Thank you so much.
Thanks and Regards,
Natalia
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2022 07:03 AM
Glad to help.
Please mark response helpful as well.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2022 02:38 AM
Hi Natalia,
This it's an OOTB script include, if you want add that condition you should edit it as follows:
ResourcePlanReferenceQual.getGroupReferenceQual = function(current) {
var groupsMatchingUser = [];
if(JSUtil.notNil(current.user_resource) && current.resource_type == 'user') {
var rmUser = new ResourceManagementUser(current.user_resource);
groupsMatchingUser = rmUser.getResourceGroups();
return 'sys_idIN'+groupsMatchingUser.join(',')+ '^u_field=' + fieldValue;
}
else if(JSUtil.notNil(current.role) && current.resource_type == 'role') {
var groupsMatchingRole = [];
groupsMatchingRole = ResourceGroupRoles.groupsHavingRole(current.role);
return 'sys_idIN'+groupsMatchingRole.join(',')+ '^u_field=' + fieldValue;
}
return 'roles=pps_resource^active=true^u_field=' + fieldValue;
};
If you need another kind of query add it at the end of each return where '^u_field=' is.
If it was helpful, please give positive feedback.
Thanks,
☆ Community Rising Star 22, 23 & 24 ☆