How to query Change Request record by condition (current user is in group of creator)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2019 04:32 AM
Group1 has User1, User2 and User5 as picture below.
Group2 has User3, User4 and User5 as picture below.
Change Request number CHG0030046 is created by User1 and CHG0030047 is created by User3 as picture below.
How to query Change Request record by condition (current user is in group of creator)?
User1, User2 can see only Change Request number CHG0030046.
User3, User4 can see only Change Request number CHG0030047.
User5 can see both Change Request number CHG0030046 and CHG0030047.
For example: Can see only Change Request number CHG0030046 when User1 login.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2019 04:40 AM
Hi,
For this you need to write query business rule and script as below
var groups = gs.getUser().getMyGroups;
groups = groups.toString();
current.addQuery('assignment_group', 'IN', groups);
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
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
05-23-2019 09:30 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2019 10:17 PM
Hi,
Write query business rule on change_request table.
test it once
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
06-04-2019 09:17 PM
Thank you. I will check, test and reply within this month.