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.

View solution in original post