- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2024 10:02 AM
I need to report User IDs for respondents on the sn_grc_item table and I'm attempting to do so with a database view. I'm building a view that relates the Name field on the sys_user table to the Respondents field on the sn_grc_item table. But the result is showing empty User ID's. What am I doing wrong?
Thanks,
Jim
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2024 01:34 PM
Hi Jim,
Your screenshot shows a different table, so that's curious. The respondents field on sn_grc_item is a List field referencing the sys_user table, so you would need to use usr_sys_id in the Where clause instead of usr_name, but since a List can contain more than one record, the standard Where clause pointing to one record on the user table from one sys_id on the Control/Risk table will not work. Time for a graduate-level implementation of a Database View. You could do this with a Query Business Rule that runs on the Database View Table, like some hot shot proposed in this post:
https://www.servicenow.com/community/platform-analytics-forum/database-view-list-field/m-p/1262510
but there is a way to do this without the Business Rule. I'll use a more common example where I have some data in my PDI - Show the User ID for every user listed on the Watch List of incidents.
!isnull(inc.watch_list)
instr(inc.watch_list, usr.sys_id)>0
So you should be able to replace watch_list with respondents, and of course change the 100 Table, to get similar results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2024 01:34 PM
Hi Jim,
Your screenshot shows a different table, so that's curious. The respondents field on sn_grc_item is a List field referencing the sys_user table, so you would need to use usr_sys_id in the Where clause instead of usr_name, but since a List can contain more than one record, the standard Where clause pointing to one record on the user table from one sys_id on the Control/Risk table will not work. Time for a graduate-level implementation of a Database View. You could do this with a Query Business Rule that runs on the Database View Table, like some hot shot proposed in this post:
https://www.servicenow.com/community/platform-analytics-forum/database-view-list-field/m-p/1262510
but there is a way to do this without the Business Rule. I'll use a more common example where I have some data in my PDI - Show the User ID for every user listed on the Watch List of incidents.
!isnull(inc.watch_list)
instr(inc.watch_list, usr.sys_id)>0
So you should be able to replace watch_list with respondents, and of course change the 100 Table, to get similar results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2024 08:19 AM
This is exactly what I needed. Thank you.
FYI...
* u_control_attestation_respondents is the name of my database view.
* My GRC friends have guaranteed me there will always be only one attestation respondent. But I will keep your additional suggestion close at hand in case this changes.
Thanks,
Jim