Adding a profile setting to your mashup

This blog describes how you can add your own profile setting, for example an URL to a SOAP web service, to your mashup so that your profile setting can be delivered and deployed as part of your mashup.

In Lawson Smart Office we have two main different types of settings. We have settings in settings files; these are the user settings and applications settings that can be administrated via group policies. Examples of user settings are my M3 default option or the theme color of my Canvas. Examples of applications settings are if private deploy of mashups is allowed or if the user is allowed to change the theme. Those are set by the administrator and cannot be changed by the user.

We also have settings that are more releated to the environment, such as Server URLs, ports and what features should be enabled. This type of information is stored in the profile (profile.xml on the server).

Mashups can access both types of settings but only profile settings can be included in the Mashup application. If the application is then installed via LCM it is possible for the administrator to change the value in the advanced view of the Profile Editor tool within Lawson Smart Office.

If you need user settings you need to do some SDK development so that your application contains both c# code (a feature) and a Mashup. But for some simple key-values that are set for all users, using the profile is easy and I’ll show you how.

We will start with a mashup project with at least one XAML file.

1. Go to the project explorer and select the project name in the tree control. In the image below my project is WSExamples. Click it to select it.

2. As you click the Properties tab will be updated with the properties tab for the selected item. Now if the properties tab does not change simply click the XAML file and then the project node again.

3. Click on create to create a new profile xml file. You will be promted to enter a name and location for the file. Profile.xml is a good name. Make sure you place it in the same folder as your other project files. Add can only be added if you have already created a profile xml with the correct syntax.

4. Once you have created the file you click edit and you will see the window below.

5. Note that the WSExamples is used as a node so make sure your project name is unique (compared to other mashups with profiles) or use a better name than URL. Launch externally will open the xml file in the default program for XML files on your computer. For me that is Internet Explorer. So skip that! Click the open folder and open the Profile.xml (or profiles.xml) in your favorite xml editor.

6. I changed my XML to look like this:

<?xml version="1.0" encoding="utf-8"?>
<Profiles>
<Profile group="Mashup">
 <WSExamples>
    <CustomerWSUrl>https://myserver/Service.svc</CustomerWSUrl>
  </WSExamples>
</Profile>
</Profiles>

6. To access the value enter it as a binding. For example:

<TextBlock Text="{mashup:ProfileValue Path=Mashup/WSExamples/CustomerWSUrl}"/>

7. You can use the binding to access any value in the profile. The Path contains of groupName/ApplicationName/KeyName. For example use the path “M3/Companion/Url” to access the Url for Companion.

5 thoughts on “Adding a profile setting to your mashup

  1. thibaudatwork

    Hi Karin. Thanks for the example. I tried it with my employee userid in LVE14 Smart Office 10.0.5.0.38, and I tried at a customer with M3SRVADM and Smart Office 10.0.4.0.38, but without luck in either case. I copy/pasted your examples with the WordPress icon “copy to clipboard” to avoid any typing errors. And I tried many things: I saved the project, I closed/re-opened the Mashup Designer, I logged off Smart Office, I deployed as Local application, but none of these bring the value in the Mashup. Also, I don’t see the Mashup section in the Administration tools > Profile Editor. I had done this twice at another customer last year and it worked fine, I was getting the value of my profile.xml and I was seeing the Mashup section in the Profile Editor. What could I be doing wrong this time? Thanks. /Thibaud

    Reply
    1. karinpb Post author

      If you only deploy locally then profile information will not be used. That is becuase there is no way to change that setting for a non-admin and there is no notion of a local profile. We could implement some kind of fallback for profile information but in that case we need to be able to configre those values in “My applications” as well since the user have to be able to change those values.

      So it is currently not supported. I’ve been thinking about adding an warning message do the deploy. I think we aleady have a development ticket for that but it has not been implemented yet. It would have been different if we had a support case from a customer. Customers are our priority.

      We don’t read local values. Not for profile information in Mashup (development work around would be use a local dev profile)

      Regards Karin

      On 11 jan 2013, at 18:04, Developing for Infor Smart Office

      Reply
  2. Amanda

    Is it possible to translate the Key “Enter” on the keyboard to be an Event when you have a Button, and you are typing in the valu you want, f ex customer, and instead of tabbing to the BUTTON, just press Enter

    Reply
    1. karinpb Post author

      Absolutely. You can use bindings for keyboard mappings in general but for buttons there is a specific property you can use if you have one button and that should be the default button.Set the property “IsDefault=’True'” on the button. I think that this option is available in the advanced tab in the Designer. “IsCancel” is also a default behaviour on WPF buttons and it will fire click when you press escape.
      But there is no support for mapping specific textboxes to buttons to say that when I’m in this textbox and press enter I want this event to be triggered. Would that be enough for your scenario?

      Reply

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s