Caller is not (dynamic) one of my Assignment group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2023 09:23 AM
Hi,
I have the field 'hide_incident' of type True/False.
I need to write a BR query on the incident table that will meet these 2 conditions:
1) hide_incident = True
2) caller and login user are not in the same assignment group.
How can I achieve that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2023 09:55 AM
these two conditions are met:
1) hide_incident = True
2) the login user is not in the same group as the caller (no matter what is the assignment group of the incident)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2023 10:04 AM
Hi @Alon Grod
Do you want a query business rule or insert/update BR?
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2023 10:08 AM
@Saurabh Gupta hi i want query BR.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2023 10:11 AM
Hi @Alon Grod
I think this is not possible as in query BR current object is not available and hence we cannot check the groups of caller.
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2023 09:03 PM - edited 02-18-2023 09:04 PM
@Alon Grod This is possible with before query but script will be complicated as you need to get all incident callers and check in all groups combining logged in user. and storing big list of incident numbers sending that as query.
Best option is write read ACL
in script
var arr = [];
var loguser = gs.getUserID();
var caller= current.caller_id;
var group = new GlideRecord('sys_user_group');
group.addQuery('active',true);
group.query();
while(group.next()){
var groupmem = new GlideRecord('sys_user_grmember');
groupmem.addQuery('group', group.sys_id);
groupmem.addQuery('user','IN',loguser,caller);
groupmem.query();
if(groupmem.getRowCount() ==2){
arr.push(groupmem.group.toString());
}
}
if(arr.length>=1){
answer= true;
}else{
answer = false;
}
Bharath Chintala