Smart Office Hot Fix 12 was just released (10.2.0.88). We have some new features and in this post I’ll cover a changes to the MIPanel that will make it easier to chain calls together. The new features for the MIPanel are:
- New events: CompletedSuccessfully and CompletedWithError
- New properties: ShowMessagesInDialog and ShowMessagesInStatusBar
- New result property that you can bind to: MIPanel.ErrorInfo. This property will contain error information from the first failed transaction. It has ErrorMessage, ErrorCode, ErrorField, Transaction and Program.
For those of you who have use conditions on events you can now consider using the new events. An example scenario would be updating item information and if that transaction is successful you would like to run another transaction. In that case you can trigger the second update based on CompletedSuccessfully instead of UpdateCompleted.
Please note that I have some hard coded values in the example. I did have to configure MandatoryInputFields since I’m not changing the item number as the behavior of the MIPanel is to only send updated data to an MITransaction. The use of the event is pretty straight forward. For numeric input I used the NumericTextBox. You will not find it in the Designer UI but it is part of Smart Office so you can use it if you edit the XAML. Here is the XAML:
<Grid 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"> <Grid.ColumnDefinitions> <ColumnDefinition Width="1*" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="1*" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <m3:MIPanel Name="ItemDetail" Grid.Row="0" Margin="0,15,0,0"> <m3:MIPanel.Events> <mashup:Events> <mashup:Event SourceEventName="Startup" TargetEventName="Get"> <mashup:Parameter TargetKey="ITNO" Value="AC-001" /> <mashup:Parameter TargetKey="FACI" Value="010" /> </mashup:Event> </mashup:Events> </m3:MIPanel.Events> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="10" /> <ColumnDefinition Width="200" /> <ColumnDefinition Width="15" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="5" /> <RowDefinition Height="Auto" /> <RowDefinition Height="5" /> <RowDefinition Height="Auto" /> <RowDefinition Height="5" /> <RowDefinition Height="Auto" /> <RowDefinition Height="10" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Label Content="Item number:" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0" Padding="0" /> <TextBox MaxLength="15" Text="{Binding [ITNO]}" IsEnabled="false" Grid.Row="0" Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Center" /> <Label Content="Name:" Grid.Row="2" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0" Padding="0" /> <TextBox MaxLength="30" Text="{Binding [ITDS]}" Grid.Row="2" Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Center" /> <Label Content="Description 2:" Grid.Row="4" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0" Padding="0" /> <TextBox MaxLength="60" Text="{Binding [FUDS]}" Grid.Row="4" Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Center" /> <Label Content="Avergage cost:" Grid.Row="6" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0" Padding="0" /> <ui:NumericTextBox MaxLength="10" Name="inputAPPR" Text="{Binding [APPR]}" Grid.Row="6" Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Center" /> <Button Name="SaveButton" Content="Update" Grid.Row="8" Grid.Column="2" HorizontalAlignment="Right"> <Button.CommandParameter> <mashup:Events> <mashup:Event TargetName="ItemDetail" SourceEventName="Click" TargetEventName="Update" Debug="True"> <mashup:Parameter TargetKey="ITNO" Value="{Binding [ITNO]}" /> <mashup:Parameter TargetKey="FUDS" Value="{Binding [FUDS]}" /> <mashup:Parameter TargetKey="ITDS" Value="{Binding [ITDS]}" /> </mashup:Event> </mashup:Events> </Button.CommandParameter> </Button> </Grid> <m3:MIPanel.DataSources> <m3:MIDataSourceList> <m3:MIDataSource Program="MMS200MI" Transaction="Get" Type="Get" InputFields="ITNO" OutputFields="ITNO,ITDS,FUDS" /> <m3:MIDataSource Program="MMS200MI" Transaction="GetItmFac" Type="Get" InputFields="FACI,ITNO" OutputFields="APPR" /> <m3:MIDataSource Program="MMS200MI" Transaction="UpdItmBasic" Type="Update" InputFields="ITNO,ITDS,FUDS" MandatoryInputFields="ITNO" /> </m3:MIDataSourceList> </m3:MIPanel.DataSources> </m3:MIPanel> <m3:MIPanel Name="SecondUpdatePanel"> <m3:MIPanel.Events> <mashup:Events> <mashup:Event SourceName="ItemDetail" SourceEventName="CompletedSuccessfully" TargetEventName="Update" Debug="True"> <mashup:Event.Conditions> <mashup:Conditions> <mashup:Condition SourceValue="{Binding ElementName=inputAPPR, Path=Text}" TargetValue="{Binding ElementName=ItemDetail, Path=[MMS200MI.GetItemFac.APPR]}" Operator="NotEqual" /> </mashup:Conditions> </mashup:Event.Conditions> <mashup:Parameter SourceKey="ITNO" /> <mashup:Parameter TargetKey="FACI" Value="010" /> <mashup:Parameter SourceKey="APPR" /> </mashup:Event> </mashup:Events> </m3:MIPanel.Events> <m3:MIPanel.DataSource> <m3:MIDataSource Program="MMS200MI" Transaction="UpdItmFac" Type="Update" InputFields="FACI,ITNO,APPR" /> </m3:MIPanel.DataSource> </m3:MIPanel> <ui:StatusBar Name="StatusBar" Grid.Row="3" Grid.Column="0" /> </Grid>
Unfortunately the Documentation in the Mashup Designer is not updated with the new properties etc as there has been no update to the Mashup Designer. You can always find the latest API documentation in the Smart Office SDK.
Please note that these events applies to update transactions. You set the type of the transaction on the MIDataSource. We will automatically try and determine the type based on the transaction name.
For a full listing of changes made on this release, refer to Lawson KB 1626878 / M3 KB 1623430.
Hi Karin,
Thanks for posting this new functionality about the MI Panel.
We already installed the latest version of the Mashup designer.
I have a question regarding this, I created an example using a Get functionality but I can’t make it to show the pop-up message, it only shows the message in the status bar.
Hope you can help me.
Thank you in advance!
Below is the code for the example XAML.
Please provide the example by escaping the code. I think that for Get it is possible that it will only be shown in the status bar as it is implemented as a standard DataSourceProvider. It might be something that we can fix but the main focus was on update calls.
Okay, thanks Karin.
Hi Edz, Sorry for the late reply. The error dialog will not show automatically for get and list transactions. A new property on the MIPanel called ShowListAndGetMessagesInDialog has been added. It will force the dialog. Even though ShowMessagesInDialog should have been enough we can’t change the default behavior not to show dialogs for get requests as it would affect existing Mashups. Any addition or change to Mashup controls has to be done with care so even if I would like to have less and clearly defined properties it is not possible due to the risk for Mashup developers. This new property should make it to HF19 of Smart Office.
hi
I wrote a Mashup for update Item Master data . it gives below error when I press save button . But your example is working fine . Please help….
Error Message is : Transaction UpdItemBasic in program requires a value for field ITNO
I feel Textbox value of ITNO is not set to API ITNO field .
<!–
–>
Please escape using the tips here: https://en.support.wordpress.com/code/posting-source-code/
Edit by Karin: Not sure what you did but tabs will mess up the code and everything was URLEncoded so I added the source tag and fixed the format.
Hi,
When defining your update data source you must specify the fields that are mandatory. If not they will not be sent to BE. We have been asked only to send those fields in the update transaction that has been *changed* and since we have the data before any changes we see that ITNO isn’t changed so we don’t included it.
Don’t forget to set IsEnabled=false on the ITNO field as well.