How to get the current username in a Mashup

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:

  1. Add this namespace to the Mashup:
    xmlns:Services=”clr-namespace:Mango.Services;assembly=Mango.Core”
  2. Then get the UserName like this:
    <TextBlock DataContext=”{x:Static Services:ApplicationServices.UserContext}” Text=”{Binding UserName}” />
  3. 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.

Published by

thibaudatwork

M3 Technical Consultant

2 thoughts on “How to get the current username in a Mashup”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s