I've have a page in which I load a list, and in each element another list (like a table). In every element, I need to check 3 or 4 roles, so, depending on the number of elements I have to check the roles hundreds of times.

So, I was wondering how the check role works and its performance:

  • Where role-user is stored? In cache? In session? In DB?
  • Every time I check a role is re-executed the checking role function againt DB, or exist some cache mecanism in page that detect the same checking-role to check it only once?
  • Would improve the performance if I assign the role checking result to a local variable in preparation and use that local variable in each element, instead of the check-role function in each element?


Hi Carlos,

The User/Role relationship is kept in the Users database, you can see the entities if you look at System entities. Essentially the relationships are between User(s), User_Role(s), Role(s), and Group(s), Group_Role(s) and Group_User(s)  and there is a "view" of User_Effective_Role(s).

An OutSystems tech would have to answer your question exactly as to how the check functions work but I suspect they will query the database each time., i.e. hundreds of times.

Not knowing the exact use case ...

1. Performing your own logic to check the role once and store it locally seems like a reasonable idea.

2. Also you could add the user-role table to your join and only get the data they can see if that works?




Are we talking about the same 3 or 4 roles for every row of your list?

If this is the case, you should add your 3 or 4 CheckRole() actions to the screen's Preparation. The result will then be available everywhere within the Screen context...