user in multiple departments

Hi, Mendix noob as I am I would value your input;   I have endusers which normally work for just one department. Some are skilled to work for more than one department but only for one department at the time. Of course departments will have many endusers. When these endusers log on I want to present them a list of all the departments they can be assigned to so they can choose which department they are working on that day. They should see only the records relevant to the department they’re working for at that time.   So my domain model has entities ‘administration.account’ and ‘department’ and a many to many association ‘account_department’. I have succeeded in setting up a microflow which detects the amount of departments the enduser has but I can not think of a way to present the enduser with a choice of the departments he or she is entitled to.   I tried a dataview showing all departments restricted with an xpath like [Administration.Department_Account/Administration.Account = '[%CurrentUser%]’ but that results in ‘incompatible expression types: Boolean, system user’. In other attempts my page ‘should contain a data view that accepts an object of type ‘account’ but what i really want to do is displaying departments, Or do I?   I must be thinking wrong, any idea's on what I should try? Thanks for your time.   Bert
3 answers

Hi Bert,


I would create a page where the current user account is being passed into the data view. Then you can create a data grid in that data view listing the departments that user has been assigned to (over association so they see the applicable list of departments) and you can add a manual select button on the data grid that passes that department as a parameter into the microflow that shows the page you need.




PS: with [Administration.Department_Account/Administration.Account  you are checking whether there is an association (so that is why it says it needs a boolean).

If you make it: [Administration.Department_Account =  '[%CurrentUser%]’ ] or  [Administration.Department_Account/Administration.Account/id =  '[%CurrentUser%]’ ] that could probably also work.


Hello Bert,

I would try [Administration.Department_Account= '[%CurrentUser%]’  as your Xpath for displaying, then I would create a *-1 association from user to department for you to store the currently selected department. You can then use the *-1 in your xpath to show only the relevant records for the currently selected department.

Hope this helps


Both are very helpful responses, unfortunately I can only flag one as ‘answer’.