- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2022 01:16 AM
Hi All
Need to get the below 3 values in Query BR how it can be achieve?
1. How we can get the current logged in user assignment group and its parent group in query BR?
2.How all Ritm group and its parent group can be get from Query BR.
3. If 1 and 2 are same(both condition returns same value) then those Ritms should only visible to logged in user
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2022 11:57 AM
(function executeRule(current, previous /*null when async*/ ) {
var childIds = "";
var groups = new global.ArrayUtil().convertArray(gs.getUser().getMyGroups());
groups = groups.toString();
current.addEncodedQuery("assignment_group.parentIN"+groups+"^ORassignment_groupIN"+groups);
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2022 05:06 AM
Hi jobin,
Give this a try:
(function executeRule(current, previous /*null when async*/ ) {
//var a = new global.ArrayUtil().convertArray(gs.getUser().getMyGroups());
var arr = [];
var arr1 = [];
var grG = new GlideRecord("sys_user_grmember");
grG.addQuery("user", gs.getUserID());
grG.query();
while (grG.next()) {
arr.push(grG.getValue("group"));
}
var grA = new GlideRecord("sys_user_group");
grA.addQuery("parent", "IN", arr.toString());
grA.query();
while (grA.next()) {
arr1.push(grA.getUniqueValue());
}
current.addQuery("assignment_group", "IN", arr.toString() + arr1.toString());
})(current, previous);
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2022 05:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2022 05:18 AM
Hi,
Do you want to show the child group RITM's if that user is a part of parent group of its child group?
If yes then above should work I tested in my PDI and its working.
Please share screenshots if not working
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2022 05:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2022 05:24 AM
Correct. I got your point, the above code takes the logged IN user groups and it will check the parent field in group table and it takes all the child groups
Murthy