I want to assign a user to each record in an entity (called Games), but need to filter the IDs only for one role. How can I do it, so that when the Games entity record is being created, the combobox to add use only shows User Ids from users that belong to the role "GameAdmin".
I have tried to create a structure with GameAdmins, but couldn't find the user roles to use in the SQL statement.
are the roles persistent?
if so, you can check the User_Effective_Role or User_Rol from the System
You can use the (System) entity User_Effective_Role to achieve that. For instance, you can have an Aggregate querying your users and have a Only With join with the User_Effective_Role entity (e.g. User.Id = User_Effective_Role.User_Id) with a filter over the GameAdmin role (e.g. User_Effective_Role.Role_Id = Roles.GameAdmin).
Alternatively, you can filter the query results in memory by using the CheckGameAdminRole function. If happen to be using version 10, you can use the ListFilter action under (System) to achieve this easily.
Let me know if that helps,
Edit: J. was faster than me :)
Just to add yet another alternative:
You can also use the CheckRole built-in function in an Aggregate filter, although it is probably less efficient than having a Join with User_Effective_Role for your use case.
I must have done something wrong as I cannot see the User_Effective_Role entity in the System, only User.
Apologies for my basis issues.
If your module doesn't have it already, you need to add a reference to it by going to Manage Dependencies (main toolbar, or under the Module menu) and finding the User_Effective_Role entity in the (System) references.
Many thanks. All solved.