Extract Names of A Particular Role

I am new to outsystems. I create two roles Interviewer and People. Is there any way of extracting all the names of a particular role. For example can I extract all the names of the users that are interviewer.

Theow Meng Ang wrote:

I am new to outsystems. I create two roles Interviewer and People. Is there any way of extracting all the names of a particular role. For example can I extract all the names of the users that are interviewer.

Hi Theow,

You can get the name of roles by writing a simple query using Role Entity, It is there under System module.



Thanks,

Sachin


Theow Meng Ang wrote:

I am new to outsystems. I create two roles Interviewer and People. Is there any way of extracting all the names of a particular role. For example can I extract all the names of the users that are interviewer.


Yes you can. Search in "Manage Dependencies" for the (system) module and there you can find the User_Role entity. If you have that dependency, you can create an aggregate with both the Users and User_Role entities. That you can filter on the users with one of the roles. 

Sachin Mahawar wrote:

Theow Meng Ang wrote:

I am new to outsystems. I create two roles Interviewer and People. Is there any way of extracting all the names of a particular role. For example can I extract all the names of the users that are interviewer.

Hi Theow,

You can get the name of roles by writing a simple query using Role Entity, It is there under System module.



Thanks,

Sachin


This is not totally true. The Role Entity doesn't have a direct connection to the Users Entity. You should use User_Role. 


Martin Rozeboom wrote:

Sachin Mahawar wrote:

Theow Meng Ang wrote:

I am new to outsystems. I create two roles Interviewer and People. Is there any way of extracting all the names of a particular role. For example can I extract all the names of the users that are interviewer.

Hi Theow,

You can get the name of roles by writing a simple query using Role Entity, It is there under System module.



Thanks,

Sachin


This is not totally true. The Role Entity doesn't have a direct connection to the Users Entity. You should use User_Role. 


I agree Martin, This is just to fetch the roles, however, if it needs to fetch the users for a particular role we have to query in User_Role Entity.

Thanks,

Sachin

Then if I export User_Role. Must I recreate the roles that I have already created.

Theow Meng Ang wrote:

Then if I export User_Role. Must I recreate the roles that I have already created.


No, you can just use them

When I fetch them I have an error in one of my prepartion that use the user entity, what is the value of the role Id.

I really don't understand this error

Theow Meng Ang wrote:

When I fetch them I have an error in one of my prepartion that use the user entity, what is the value of the role Id.

I really don't understand this error

Can you share the code? Now I can't say anything about it. 

Sorry is my mistake. There no error