Here is the solution to start a Mashup in Lawson Smart Office with input parameters.
- Suppose we have a Mashup located at:
C:\Test.xaml
- The URI to launch that Mashup in Smart Office would be:
mashup:///?BaseUri=C:\&RelativeUri=Test.xaml
- To send a key:value pair as an input parameter to the Mashup we add the parameter DefaultValues to the URI with an arbitrary key and an arbitrary value separated by a colon. In this example I chose a key InputParameter with a value Hello World! and I URI-encoded them:
DefaultValues=InputParameter:Hello+World!
- The resulting URI is:
mashup:///?BaseUri=C:\&RelativeUri=Test.xaml&DefaultValues=InputParameter:Hello+World!
- In the Mashup we receive the value with the following Binding:
{Binding Converter={StaticResource CurrentItemValue}, ConverterParameter=InputParameter, Mode=OneTime}
- We can show the value in a TextBox for example:
<TextBox Text="{Binding Converter={StaticResource CurrentItemValue}, ConverterParameter=InputParameter, Mode=OneTime}" Grid.Column="1" />
- For that Binding to work we must add the converter Mango.UI.Services.Mashup.CurrentItemValue to our Grid.Resources:
<Grid.Resources> <mashup:CurrentItemValue x:Key="CurrentItemValue" /> </Grid.Resources>
- Now let’s start the URI:
- Here’s the result, the input parameter is shown in the TextBox!
- We can also send multiple input parameters by separating the key:value pairs with semi-colons:
InputParameter1:Hello+World!;InputParameter2:Yeehaa!;InputParameter3:ABC123
- The new URI is:
mashup:///?BaseUri=C:\&RelativeUri=Test2.xaml&DefaultValues=InputParameter1:Hello+World!;InputParameter2:Yeehaa!;InputParameter3:ABC123
- The new result is:
Here is a screenshot of the final XAML in the Mashup Designer:
Here is the complete XAML source code:
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"Â xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"Â xmlns:ui="clr-namespace:Mango.UI.Controls;assembly=Mango.UI"Â xmlns:mashup="clr-namespace:Mango.UI.Services.Mashup;assembly=Mango.UI"Â xmlns:m3="clr-namespace:MForms.Mashup;assembly=MForms"Â Margin="10">
This solution was given by the following sample provided in the Mashup Designer:
That’s it!
UPDATE 2013-01-31:
Note 1: My example above showed the URI to start a Mashup from the C:\ drive and folder. But to start a Mashup that is deployed, the BaseUri must point to the *.mashup file, for example: mashup:///?BaseUri=MyMashup.mashup&RelativeUri=MyMashup.xaml&DefaultValues=key1:value1;key2=value2 . This will work with a Mashup deployed either privately (Mashup Designer > Deploy > Private), either locally (Smart Office > Show > My Local Applications). But for a Mashup deployed globally (LifeCycle Manager > Admin View > Install) you must prefix the BaseUri with the folder Mashups\, for example: mashup:///?BaseUri=Mashups\MyMashup.mashup&RelativeUri=MyMashup.xaml&DefaultValues=…
Note 2: We can create a Shortcut in Smart Office (for example, CRS610 > Tools > Personalize Shortcuts) and dynamically get values from the current panel by putting the field name in curly braces (angle brackets will work as well), for example: mashup:///?BaseUri=MyMashup.mashup&RelativeUri=MyMashup.xaml&DefaultValues=ItemNumber:{ITNO}
I tried to pass parameter from jscript to mashup.
I want to run MIList when the mashup is loading. but It is not working . but I have added button , it is working fine .
I want to call API without button .
may mashup URl is
mashup:///?BaseUri=popup.mashup&RelativeUri=popup.xaml&DefaultValues=InputParameter1:200;InputParameter2:ARA09145;MashupControlName:popup;
mashup code :
<Grid.Resources>
</Grid.Resources>
please help me .
Thank you
LikeLike
Hi Priyantha, I think there is a trick. I don’t remember well, but I think the problem is that the Startup event is executed before the converters or variable substitutions or something like that. The workaround I think is to make the variable substitution not in the event but in a hidden TextBox somewhere prior to the MIListPanel; then in the event you pull from the TextBox. It was a long time and I don’t remember where my example is on my hard disk. /Thibaud
LikeLike
Hi,
can you remember , what is the event that you used for apply text box value to MIList .
Thank you
Priyantha
LikeLike
I found a sample Mashup that I developed some time ago and that worked. I did some new tests just now and the trick doesn’t work anymore. I’m not sure what’s going on. Maybe this new version of Smart Office doesn’t support that? I suggest you ask your question in Infor Xtreme.
LikeLike
Thank you . I will ask this same question from Infor Xtreme.
LikeLike
Priyantha,
It just happens that I need this for one of my customers right now, so I did some more tests, and here is what I found:
1) In the URL for DefaultValues, I must use the M3 field name, like CUNO, instead of whatever field name I was using before, like CustomerNumber. For instance, the following will work &DefaultValues=CUNO:123 whereas the following &DefaultValues=CustomerNumber:123 will leave the customer field blank.
2) The following has no influence, so I removed it: Grid.Resources mashup:CurrentItemValue x:Key=”CurrentItemValue”
3) The following has no influence, so I removed it: {Binding Converter={StaticResource CurrentItemValue}, ConverterParameter=CUNO, Mode=OneTime}
Hope it helps,
Thibaud
LikeLike
Dear Thibaud,
<Grid.Resources>
</Grid.Resources>
mashup:///?BaseUri=popup.mashup&RelativeUri=popup.xaml&DefaultValues=CONO:200;SUNM:ARA09145;MashupControlName:popup;
LikeLike
Great! I am glad it works.
LikeLike
Hi,
Does this still apply on H5 mashup? or is there a new way of passing and getting the parameter?
Thanks in advance
Regard,
Ron
LikeLike