How can I get the currentUser Role Name and in the decision and activity parts of Microflow in Mendix 8.12.4?

0
I am learning Mendix in Mendix Studio Pro 8.12.4。 I have some Roles in My Project. And I want to discrete them By their Role Names in the Decision part of Microflow, it shows like this An error occurred: Accessing member of a list of objects is not allowed.   Also, when I want to change the attribute in my entity by the currentUser Role Name, no such attribute can be chosen, the screenshot is shown as,   But the Domain Module in System is shown as   And I do not Know how to solve them now? Can anyone with kindness help me?        
asked
3 answers
1

I had this problem recently and ended up using a workaround.

Given a user (e.g. currentUser), you can query the database for users with that name and which belong to a given group (e.g. Doctor). If you get a result then the user is in that group, if not then the user isn't in that group

This workaround may help until somebody gives a proper answer

{AC9F454C-A153-4A53-99B8-F03260A3F6DF}.png

answered
0

Hello,according to the workaround, I can do in the retrieve objects activity module, but in my project, I have several Roles to discriminate at the beginning of the microflow in the decision module, then different Roles has different activities ,and I tried the workaround in Decision, an error occurred,

no viable alternative at input ‘[’,

the screenshot is shown as,

向Mendix发问(20241011)1屏幕截图(1247).png

 

and I do not know how to solve it now.

answered
0

Hi,

User role is a list as 1 user can have multiple roles , so you cannot traverse list attribute directly in decision.

what you can do is 

1.retrieve list of roles by currentuser_roles association

2.add a filter list operation , and in that select name attribute and compar eit with doctor

see below

 

Screenshot_2024-10-11-08-48-05-023-edit_com.android.chrome.jpg

answered