Solved

GI for Restriction Groups -Customer Access (AR102000)-

  • 6 February 2024
  • 14 replies
  • 133 views

Userlevel 1
Badge

Hi!

I'm trying to build a simple GI so that a client can easily review which customer have been added to a Group or groups.

Any ideas?

Thanks in advance!

Regards.

icon

Best answer by BenjaminCrisman 3 April 2024, 19:19

View original

14 replies

Userlevel 6
Badge +6

There’s an out of the box GI called Restriction Groups by Customer that could give you the inverse of AR201000.  It’s ScreenId AR102010.

How would you like the data displayed?

Userlevel 1
Badge

Thanks for your suggestion James!

The real issue is because this client has more than 1,000 customers, and review one by one is not helpful, that's why we need to create a GI in order to review all the customers whit their restriction group assigned.

Regards!

 

Userlevel 6
Badge +6

Here’s a very simple one I threw together.  You’ll probably want to throw in some additional fields or adjust it for your use case.  ;)

You’ll need to make sure the user viewing it has appropriate rights to view all the restriction groups or it will be incomplete information.

 

Let me know if this helps.

Userlevel 1
Badge

Thanks James!

I have already reviewed the GI you send me (I had already tried it that way), however it presents incorrect information, for example:

The customer CONDUCTORA ELECTRICA only has 4 restriction groups selected.

 

But the GI show me the customer -CONDUCTORA ELECTRICA- repeated for every restriction group that exists.

 

 

Regards!

Userlevel 6
Badge +6

 I see…  Let’s take a slightly different approach - The Wyatt Erp Approach…

Acumatica stores the Group information in a table called 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.

The simplest way to check if a record is in a restriction group:

Make a Relation.  Customer is Parent, RelationGroup is Child

Include the fields you want in Results Grid.  Add this line:

=CInt((CLong([Customer.GroupMask])%(CLong([RelationGroup.GroupMask])*2))/CLong([RelationGroup.GroupMask]))

This field will now return a 1 if the Customer is part of "YourGroupName" or a 0 if it isn't. 

I don't have them written out for the A, A Inverse, B, B Inverse types, but if you want to take this further, then check out RelationGroup.GroupType.

 

The results will return a GI that looks something like this:
Where you have the customer name, the group name and a 1 or 0 as a true/false as to whether or not there’s a membership there. 

In the tables, you’ll want to create an alias for each RelationGroup you have:
 

For the Relations, you’ll want to add a relationship for each group name to each alias as follows:

I’ve only included 3 here, but as you can see, they’ll add up depending on how many restriction groups you have.  In your results grid, you’ll want it to look something like this:
 

 

You can call out these groups by joining them to any other table that’s restricted as well, and get similar results using the same structure.  

I’ve attached a sanitized version of the GI where you’ll just need to add in your groups and add more tables/aliases as needed.  Hopefully this solves your dilemma.  ;) 

Have fun!

James

Userlevel 1
Badge

Hi James! 

Thanks! I did some tests with 3 groups and the GI returns 0 and 1 as you said, but unfortunately it doesn't seem to work either, for example, the GI for the “erika” group shows me 40 records, but the group has more than 800 customers in it.

 

 

Same case with “GERARDO” group, if I filter by his formula only number 1, return 0 lines, but GERARDO has about 98 customers assigned.

 

 

 

 

Regards!

Userlevel 6
Badge +6

Interesting…. I didn’t have that same experience with this… Is your GI limiting results to X amount of records?  Are you using multiple group types other than GroupType ‘A’? I.E.: inverse groups?

Userlevel 1
Badge

There's no limit in the number of records in the GI.

The customer only uses Group Type ‘A’.

 

The GI shows the 2891 customers, that it's the same that the number of customers in the GI ‘Customers’

 

 

Regards.

Userlevel 7
Badge

Hi @adriangavino45 were you able to find a solution? Thank you!

Userlevel 7
Badge +4

@adriangavino45 For this issue are there any customers which are in more than one group? Maybe that’s a difference between what you and James are seeing?

Userlevel 1
Badge

Hi @Chris Hackett Not yet, I still have the same result and I have not been able to find the solution.

Regards.

Userlevel 1
Badge

Hi @BenjaminCrisman yes, there are customers who are in different groups.

I have tried and researched for a long time, but I don't have a correct result in the GI.

Regards.

Userlevel 7
Badge +4

@adriangavino45 If your customer is part of multiple groups then the restriction group value will change to be a combination of the values:

So if one GroupMask was 0x80000000 and another was 0x00600000 then if one entity was in both groups their mask would look like 0x80600000, which can be difficult to pull apart and I’m not certain how it would look if one group is letters and another is numbers, I have little experience trying to make GIs based off restriction groups, mainly because of the difficulty it can be.

If you know all the combinations of groups though then it could make a GI easier by using like a Switch() function.

Userlevel 1
Badge

Yes, I agree with you, there are many combinations that makes creating this GI practically impossible. First I must know all the combinations, second, if you keep adding and/or modifying the groups the combinations will never be the same.

Thank you very much to everyone for your effort and support on this topic!

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved