- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2022 08:01 AM
I am trying to create an entity filter for the Department table based on field values on that department's related CI records. (For example, departments with operational CIs.) Because this can't be done using the filter conditions UI we have created a script to do it.
The problem is that while the entity filter says it is getting the correct number of records it never actually populates the parent entity type.
A related oddity is that if I manually add the SysIDs in the same format that the script returns, then the "SysID is" filter condition returns zero records. If I use the "SysID is one of" condition the opposite is true. The manually created list returns the expected number of records and populates the entity type. If I use the script with this condition it returns zero records. Thus, the script generated list and a the same list that has been entered manually behave differently.
So... How do I achieve the goal of returning department entities based on a subset of their CIs? Is there something broken about the way script generated record lists populate entity types or am I just doing something wrong?
The only thing I can think of to fix this is to create a new table and use the script to populate it with the departments. The entity filter would then use that table to populate the entity type.
Solved! Go to Solution.
- Labels:
-
Policy and Compliance Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2022 08:33 AM
I solve the problem! In the entity filter where I call the script I forgot to add the scope at the beginning of the script name.
I.e. I called it as 'departmentswithredandpurpledata'
I should have called it as 'sn_grc.departmentswithredandpurpledata'
Now it both correctly shows the records found and adds them to the entity type.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2022 01:58 PM
Hello,
It is only when the javascript reference is in the filter condition that it fails. - Do you have your script include client-callable?
Please mark my answer as correct/helpful if it has helped you.
Thanks,
Logan
--
LinkedIn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2022 05:17 AM
Yep, the script is client callable. Could it be a scope issue? The script is in Global and the entity system is in GRC:Profiles. The script is marked as accessible from all application scopes, though.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2022 06:28 AM
Hello,
No, as long as it's Global and accessible from All then it should not be a scope issue. If you log ci.department.toString() in your script, what is it coming back with? If it is the sys_id (which it should be), what was/is experienced if you take off the toString function?
Also, can you log at the end before your return statement the department's array and post what that is returning as just to validate it is comma separated?
Please mark my answer as correct/helpful if it has helped you.
Thanks,
Logan
--
LinkedIn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2022 08:33 AM
I solve the problem! In the entity filter where I call the script I forgot to add the scope at the beginning of the script name.
I.e. I called it as 'departmentswithredandpurpledata'
I should have called it as 'sn_grc.departmentswithredandpurpledata'
Now it both correctly shows the records found and adds them to the entity type.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2022 07:11 AM
I figured it out... sort of. I switched the script to the GRC:Profiles scope. Now the entity filter works the opposite of how it worked in the Global scope. I.e. the filter claims that it found zero records but happily adds the correct records to the parent entity type. So, it is still "broken" but in a functional way. I am going to take the win and move on.