When a user object is added, I need to count the number of users with the same level of access and check the user's account against the authorized number of such users.
If Investigator.AccessLevel='Viewer' AND COUNT Investigator WHERE (Investigator.Organization=LoggedInInvestigator.Organization AND Investigator.AccessLevel='Viewer')>=LoggedInInvestigator.Organization.Viewers Then...
The above code is always evaluated as the number exceeded, when I can see that it's not.
Code says... if the user's access if Viewer, then count all of the Viewers in the same account as the logged in user and evaluate against Organization.Viewers which holds the allowed value. Am I using the COUNT function correctly?