Getting the M3 profile in a Mashup

karinpb sent me the solution to get the current M3 profile (TST, DEV, EDU, etc.) in a Mashup in Lawson Smart Office. In my case, I use the value to launch a URL with the profile as a parameter. Here is the solution:

  1. Add the namespace:
    xmlns:Services=“clr-namespace:Mango.Services;assembly=Mango.Core”
  2. Add a control that shows the value:
    <TextBlock DataContext=“{x:Static Services:ApplicationServices.SystemProfile}” Text=“{Binding Name}” />
  3. Here is a screenshot of the result:

Special thanks to Karin for the solution!

Published by

thibaudatwork

M3 Technical Consultant

10 thoughts on “Getting the M3 profile in a Mashup”

  1. Hi,

    Very good information on this page.
    Good to know this group

    Question : where can i find all the properties in the UserContext and SystemProfile ?
    I’m looking for the API port, the web service server url and ….

    Like

  2. Bonjour Hervé. You can find those properties in Smart Office > Navigator > Administration Tools > Profile Editor. You read those properties from a Mashup with for example for the LWS server: {mashup:ProfileValue Path=M3/WebService/url} . Karin posted an example. I will post another one soon.

    Like

  3. Hi,

    Thanks a lot for the valuable information. I would like to get the settings from External Profile configured in the profile editor. How can I use Jscript to get the path, parameters, etc.?

    Best Regards,
    Warren

    Like

  4. It is highly appreciated. It helps me find the right syntax to the settings of External Application Group’s property. It is something like

    Mango.Services.ApplicationServices.SystemProfile.GetProperty(‘External′, ‘FASTLSO’, ‘parameters’)

    I can now put our SQL server connection information here to make JScripts more generic.

    Thanks again.

    Best Regards,
    Warren

    Like

    1. You’re welcome Warren. Also, you can shorten the statement by adding import Mango.Services at the top of your script, by using a variable var profile = ApplicationServices.SystemProfile, and by simply calling profile.GetProperty(…). As for doing direct SQL from scripts, if that’s what you’re doing, there have been discussions on this blog and/or on http://smartofficeblog.com/ about how a bad idea it is for many reasons, one of them being the need to install/setup an ODBC driver on each user’s computer = maintenance nightmare. The preferred method is creating a Lawson Web Service of type SQL, and making the asynchronous SOAP request from the script. And there’s already a setting for LWS URL in the System Profile (the one I wrote in my previous comment) so you wouldn’t need to add your own settings to the profile. Hope it helps. /Thibaud

      Like

      1. Dear Thibaud,

        Thanks a lot for your kindness. Yes, I need to find a way to make my JScipts more generic to call SQL according to the environment. Due to your help I have found it. 10.0.5.2 allows to create new application groups, add new types and new properties. I created an application group called “FAST” (my company name) and a type called “FASTSQL” with the properties of Server, Database, User and Password. Then my scripts can get the values of those properties by calling the SystemProfile object. It is working perfectly. What I need is to replicate the application group to each environment, of course, with different property values. It is better not to use the existing External group, because it is used for launching external applications and the application name can be seen user the Other menu of the Navigator.

        The web service way is used by me only as the data source for data list panel in Mashup, which has no way to call SQL directly. It is a pain, as I have to generate the web service for each call, although the web service designer is easy to use.

        Anyway, now we have a good solution for that purpose. It is a pity that I cannot attach a screen shot here for you to have a look.

        I have another issue, which I will find a correct post to put it on.

        Thanks again and Best Regards,
        Warren

        Like

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 )

Connecting to %s