Menu-caption based on attribute-value

1
Hi there! I have a menu-item with the caption 'Account'. However, I'd like the caption to be the username of the current user. Instead of 'Account' it should show for example 'Howdy, John Johnson'. Do you know if there's any way to achieve this? Thanks!
asked
3 answers
2

Hi Marieke,

If you are using the regular menu options, then it might be quite hard to solve. Maybe even impossible.

But if you are using the NavigationList container you can do it very easily by using the Microflow Label widget which you can find in the appstore https://appstore.home.mendix.com/link/app/147//Microflow-Label.

Kind regards,

Wouter

answered
0

For the text of a menu item, your best bet would be to create an additional attribute on the Account entity, and store whatever value you'd like to display in that attribute. You could achieve this via a regular stored attribute that is updated using a commit event, or by using a calculated attribute. My recommendation would be a stored attribute for performance reasons.

For text on your page (non-menu), you could take a look at the Microflow Label widget.

answered
0

I do not think you can achieve this with the standard menu caption in Mendix. You could perhaps write a widget or some javascript that would overwrite the text to achieve your desired result.

Instead, my recommendation would be to place an action button outside of the standard menu, perhaps on the right side of the page, and set the caption of that button to an attribute of the current user's account object. You can achieve this by putting the button inside a data view with Account entity, sourced by a microflow that retrieves the current user's Account.

answered