Here is the solution to get the current username in a Mashup in Lawson Smart Office. Last week I wrote a post on How to get the current M3 profile in a Mashup which returns DEV, EDU, TST, PRD, etc. depending on which profile you are currently connected. This week I post about the username:
- Add this namespace to the Mashup:
xmlns:Services=”clr-namespace:Mango.Services;assembly=Mango.Core” - Then get the UserName like this:
<TextBlock DataContext=”{x:Static Services:ApplicationServices.UserContext}” Text=”{Binding UserName}” /> - There is also the DisplayName:
<TextBlock DataContext=”{x:Static Services:ApplicationServices.UserContext}” Text=“{Binding DisplayName}” />
Here is a screenshot of the result:
I found inspiration from the Smart Office Developer’s Guide > UserAndProfileExample.js.
2 thoughts on “How to get the current username in a Mashup”