If you mean combat group IDs: you cannot iterate over combat groups in Osiris. If you mean regular groups: those are not visible to scripting at all.
The usual way to handle this is to copy their UUIDs and put them in a database. What you can also do is create a custom behaviour script that simply sends an event to __Me in the OnInit handler, assign this script to your items, and catch that event in Osiris and then add the items to the database.