GI for Restriction Groups
Has anyone had any luck working out where the Restriction Group Data is stored?
I'm trying to build a simple Inquiry so that a client can easily review which accounts and sub accounts have been added to a Group.
When I inspect element it isn't really useful
Acumatica stores the Group information in a table callesd RelationGroup. It stores what object is part of each Group Restriction information on the records themselves. In your case, that would be the Account and Sub tables. It stores this in the GroupMask field, which is present on each of these tables as well as any others that can be a part of a group (BAccount, InventoryItem, etc.). All of the GroupMask fields are stored in the DB as a varbinary type (which is basically a list of 1s and 0s). This lets them store multiple pieces of information in the same field, and they use bitwise Math to get the values out. Anyway, how it works is a lot to get into here, but if anyone is interested let me know and I can dive deeper into it when I have some time.
To answer your question. The simplest way to check if a record is in a restriction group:
Create a GI with the tables RelationGroup and what you want to check. For this example, I will use Account, but it could easily be Sub, or InventoryItem, or Users.
Make a Relation. Account is Parent, RelationGroup is Child
Link the Relation on Parent: ='YourGroupName' Equals Child: RelationGroup.GroupName
Include the fields you want in Results Grid. Add this line:
This field will now return a 1 if the Account is part of "YourGroupName" or a 0 if it isn't.
I don't have the written out for the A, A Inverse, B, B Inverse types, but if you want to take this further, the check out RelationGroup.GroupType.