MEC Part 10 – MEC and Event Analytics

In my previous post we discussed how to trigger a MEC process based on an event occurred in M3 using Event Hub. The example we discussed was triggering a MEC process whenever a customer order line is added.

However, in some instances we need to filter out unwanted events and trigger MEC processes only when a particular scenario is occurred, say the MEC process should only be triggered when a Customer Order Line with zero price is entered. In such situations Event Analytics comes in to play.

Event Analytics is also subscribed to Event Hub, but it provides the option to define rules in it. The Event Analytics only publishes the events that satisfy the defined rules. In this post, I am not going to discuss in detail about how to define Event Analytics Rules. The intention of this post is to explain you how to use Event Analytics with MEC.

The example we are going to use here is triggering a MEC process when a customer order line with zero price is entered.

Defining the Event Analytics Rule

1. Go to Event Analytics Management Pages and Create a new Session.


2. In the dialog box displayed, give a name to the session and click OK. Once the session is created go to Rules.


3. Create a new rule.


4. In the dialog box displayed, give the rule a name and click OK.


5. Edit the newly created rule and replace the existing sample code with below code and Save it.


import com.lawson.eventhub.EventOperation;
import com.lawson.eventhub.EventPriority;

declare HubEvent

rule "LinesWithZeroPrices Subscription"

rule "LinesWithZeroPrices Rule"
     event: HubEvent(
          publisher == "M3", 
          documentName == "OOLINE", 
          operation == EventOperation.CREATE, 
          elementValues["NEPR"] == "0.0"

6. Go back to the rules and mark the new rule as active.


7. Once the rule is activated, go back to sessions and start the newly created session.


Subscribing MEC to the Event Analytics Rule

8. Once the Event Analytic Rule is defined and activated, go to Partner Admin Tool → Manage → EventHub Subscriptions → New.

9. Define the new subscription in the same way that we defined the Event Hub subscription. However, there is a small difference in the way that you have to define the subscription rule. In this case the publisher should be EventAnalytics and the Document Name should be the name of the Event Analytic Rule. So the subscription rule would be EventAnalytics:LinesWithZeroPrices. Priority and operation character are not required.


10. Assign the new subscription to the MEC-M3-EventHub Receiving channel (refer the previous post).

Note: Remember to remove the Event Hub subscription that we created in the previous post if it is still active.

11. Restart MEC, Event Hub and Event Analytics components.

12. Now whenever a zero priced item is added to a customer order, Event Analytics will generate an event and it will flow in to MEC since MEC is subscribed to this event. If the item price is not zero, no event will be flown in to MEC.

Create a new Partner Agreement and use AnalyticsHubValue XML detection (or create a new XML detection) in the Partner Admin Tool to detect the received event and trigger a MEC process. Below is a sample event file that is coming in to MEC from Event Analytics.


Have a Nice Day…

MEC Part 9 – MEC and Event Hub

In the previous post we discussed about how to use printing of a M3 document to trigger a MEC process using MBM initiator. In this post we will look at how to use M3 Event Hub to trigger a MEC process based on an event occurred in M3.

If you are familiar with the Publisher-Subscriber Design Pattern, M3 Event Hub acts as an event publisher, which broadcasts  defined events when they occur. Any channel subscribed to M3 Event Hub can receive these events. MEC provides a option of subscribing its receiving channels to Event Hub, so that it can receive events published by the Event Hub and trigger MEC processes based on these events.

Let’s say we want to trigger a MEC process, whenever a new Customer Order Line is added to a customer order.

1. First of all a receiving channel should be defined in the Partner Admin Tool to receive events from M3 Event Hub. For that go to Partner Admin → Manage → Communication → Receive Tab and create a new Receiving channel. Give a desired name and set the protocol to EventHub Subscriber. You can leave the other parameters as they are.


2. Now we have to subscribe to an event in M3 so that Event Hub generates a trigger when that particular event occurs. This can be directly done through Partner Admin Tool. For that, go to Partner Admin → Manage → EventHub Subscriptions → New.


3. Give a name and a description to the subscription. In this case we are trying to capture the event of adding a customer order line. So I have named it as Customer Order Line Create Event.

4. Then we have to define the subscription rule in the below pattern.


5. According to above pattern, our subscription rule would be M3:OOLINE:C: :P2. Once the subscription rule is entered click OK.


6. Now this newly created subscription should be assigned to a receiving channel. For that, select the created subscription from EventHub Subscriptions list and click Edit. In the displayed dialog tick the correct receiving channel.


7. For this subscription to take effect MEC and Event Hub components should be restarted. Once these components are up, go to Event Hub Management Pages.

8. Newly created MEC receiving channel MEC-M3-EventHub should now be in the subscribers list and there should be one subscription in this subscriber.


9. If you go in to the subscriptions, you will see the subscription we defined in the Partner Admin.


10. Now whenever a customer order line is added (a record is created in OOLINE table), Event Hub will generate an event and it will flow in to MEC since MEC is subscribed to this event.

Create a new Partner Agreement and use AnalyticsHubValue XML detection (or create a new XML detection) in the Partner Admin Tool to detect the received event and trigger a MEC process.


Have a Nice Day…

MEC Part 8 – Using MBM Initiator

So far we have discussed how to setup a partner agreement and how to develop a MEC map so that MEC can send the details coming from an external application into M3.

In some cases, we will have to send details from M3 to external applications. For this also we will have to use a Partner Agreement and a MEC map to retrieve the information from M3 and put them into a output file. However, there should be a trigger to initiate the MEC process in this case.

M3 has provided different methods to trigger MEC processes based on different events occurred in M3 and MBM initiator is one of those methods. This can be used to trigger a Partner Agreement when a M3 document is generated.

In this post we will see how to setup MBM initiator for Customer Order Confirmation, so that a MEC process can be triggered, whenever an Order confirmation is printed.

1. There is a Default channel provided by MEC (Default MvxNGIn) to receive MBM Initiator files from M3 when they are generated. This should be enabled first in the Partner Admin Tool → Manage → Communication → Receive Tab.


2. Reload MEC Communication channels from LCM. You should now see a new communication channel called Default MvxNGIn. Note down the port. This Port no can be changed from the Partner Admin Tool if required.


3. Now, this newly enabled MEC receiving channel should be defined as a Output service in M3. For this, first add MEC Server as a output server in MNS218.


4. Define a output service type in MNS217. Interface should be XMLOUT.


5. Then create a Output service in MNS216. Server Id and Service Type should be the ones we created in step 3 and 4 respectively. Port no should be the one that was noted down in step 2.


6. Goto CRS116 and check if there is a Document Media called MBM. If not click on Actions → F14 (Gen Standard).


7. Make sure that the document for which you are going to generate the MBM initiator, is defined in CRS928. If not generate all standard documents by clicking Actions → F14 (Gen Standard).

8. Now we have to define the required document in CRS945. In this case, we need to generate the MBM Initiator for the Order Confirmation and the Document Number of the Customer Order Confirmation is 231 (OIS606PF).

9. If the Confirmation MBM should only be generated for a given Division, put the division code, else leave it blank. Put the document number and press Enter.


10. Based on the selection fields defined in the CRS928 for the given document, you can control the generation of MBM initiator. For instance, according to my CRS928 setup, the selection field for OIS606PF is Customer. So if I put a customer number here when adding a record to CRS945, the MBM initiator will only be generated for the customer orders created against that particular customer. However, in this example I want to generate the MBM initiator for all the confirmations, so I am going to leave this blank. Click Create.


11. Once the record is added to CRS945, go to Relate Options → Media from CRS.

12. In CRS949, connect the MBM media control object to 231 document. Make sure that the Copy parameter is set to 2 if the MBM initiator should be generated for both original document and copies.


13. Make sure that Media Control Selections are set to 3 in MNS204 for the selected document.


Whenever you print Customer Order Confirmation, M3 should now submit a MBM initiator file to MEC. MEC receives this initiator file through the MvxNGIn channel. Create a new Partner Agreement and use one of the standard XML detection in the Partner Admin Tool to detect the generated MBM Initiator File.


Have a Nice Day….

MEC Part 7 – Set Proper Name for the Output File

In my last post we looked at how to develop a MEC mapping and how that can be used in a Partner Agreement. However, the name of the output file that is created in the process is an auto-generated one which is not really meaningful.

Output Files

In some integrations, the output file name becomes very important because the 3rd party application decides what to do with the MEC output file completely based on its name. Therefore, it is really important to put a meaningful name to the output file.

In the example we looked at in the previous post, let’s say that we need to set the output file name to CustomerOrderCreate_<<CustomerPortalOrderId>>_<<DateTime>>.xml

Along with every MEC message processed, a manifest file is generated. We can map a value from this manifest file as the file name of the output file. To do this,

  1. First we need to store the desired file name in the manifest file
  2. Then when the output file is sent to the output channel, it should read the file name from the manifest file and assign it as the file name.

Storing File Name in Manifest File

1. At the end of the MEC mapping add a new Java Function as show below.

Update Manifest

2. Implement below code in the Java function. We use a standard MEC function called setManifestInfo() to store our file name to a new variable in the manifest file. The new variable that we are adding to the manifest file is map:fileName.

private void manifestUpdate() throws Throwable {
	java.text.DateFormat dateFormat = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
	java.util.Date date = new java.util.Date();
	String dateTime = dateFormat.format(date);
	String fileName = "CustomerOrderCreate_" + i_CustomerPortalOrderId.trim() + "_" + dateTime;

	setManifestInfo("map:fileName", fileName);

3. Save the update MEC mapping in the MEC database, generate it, publish it and reactivate it.

Assigning File Name to the Output File

1. This should done in the Send channel. For that go to Partner Administrator → Manage → Communications → Send

Send Channels

2. Change the required send channel as shown below. Assign map:fileName variable to File Name and check Make file name unique parameter.

Send Channel

Drop a customer order create request to the input folder and check the output file generated. Now the output file will contain a meaningful name.

Have a nice day….

MEC Part 6 – Your Very First MEC Mapping

In this post we will see how to develop a MEC mapping to create basic customer order inside M3 and return the Order number of the created customer order back. First download the input and output XML schema required for the mapping from my previous post.

Now open the MEC Mapper. I assume that at this point you have already setup a workspace and configured MEC mapper with required server connection details. We have already discussed how to setup MEC mapper in one of my previous posts.

Developing the MEC Map

1. Once you log in to the MEC Mapper, right click on the Mapping Explorer and click on New Project.

New Project

2. In New Mapping Project window, give Project a name (CustomerPortal) and click Next. This will create a new project.

3. Right click on the newly project and click on New Mapping.

New Mapping

4. In New Mapping Name and Document window, give mapping a name (CustomerPortal_CustomerOrderCreate).

5. Then select input and output XML schema that you have already downloaded and click Next.

New mapping window

6. In Root Elements window see if MEC mapper has correctly identified the root elements of both input and output schema. For input schema, it should be CustomerOrder and for Output schema it should be CustomerPortalResponse. Click Finish.

7. This will add the new mapping to the project. Double click on the newly created MEC map to open it in the Mapping Manager. Below image illustrates different component in the Mapping Manager.

Mapping Manager

8. First we will read Order Header Details from input schema in to the MEC mapping. For that we will add a Java function to the mapping. Click on the Java under Core Functions in toolbox and then click on the sequence list area.

Adding a Java Function

9. Once the Java function is added to the mapping, click on the select tool in toolbox.

10. Then click on the newly added java function and go in to Properties tab in Mapping Console area. In properties, give function a proper name and a description.

Functions Properties

11. Then we need to add input variables to this function to read values from input schema and pass then in to the function. For that right click on the function and click on Add Input Parameter.

Adding an input Parameter

12. Once the input parameter is added, click on it and go to properties. In properties, give input parameter a proper name and a description. It would be a good practice to put an “i” in front of the parameter to identify that it is an input.

Input Parameter

13. We will now assign the customer number from input schema to the newly added input parameter. For that, select Link tool in toolbox, click on CustomerNumber node in input schema and then click on the newly added input parameter (i_CustomerNumber).

Input Parameter Assignment

14. In the same way, assign remaining Order Header details in input schema to input parameters.

All Input Parameters

15. Then we need to add output parameters to this functions to take some data out. For that right click on the Java function → Add Output Parameter.

Output Parameters

16. Once the output parameter is added, go to properties and give proper name and description. In the same way, add output parameters for all required outputs. It would be a good practice to put an “o” in front of the parameter to identify that it is an output.

All Output parameters added

17. Now we need to define the relationship between input parameters and output parameters. This should be done using the code behind this java function. To access the code behind this java function, right click on the function → Edit Java Code.

Java Code

18. Any new code that you are implementing, should go with in the main function in the code. Anything that is written outside the function gets deleted every time you go in to the code.

* Java Function to read Order Header Details from input Schema
private void readOrderHeaderDetails() throws Throwable {
	// Please implement me

19. Implement below Code in to define the relationship between input and output parameters. You do not need to define these parameters as variables, because MEC mapper has already done that for you. Once the code is implemented, save the java class and close it.

private void readOrderHeaderDetails() throws Throwable {
	o_CustomerNumber = (i_CustomerNumber == null) ? "" : (i_CustomerNumber.trim());
	o_CustomerPortalOrderId = (i_CustomerPortalOrderId == null) ? "" : (i_CustomerPortalOrderId.trim());
	o_CustomerPoNumber = (i_CustomerPoNumber == null) ? "" : (i_CustomerPoNumber.trim());
	o_RequestedDeliveryDate = (i_RequestedDeliveryDate == null) ? "" : (i_RequestedDeliveryDate.trim());
	o_CustomerContact = (i_CustomerContact == null) ? "" : (i_CustomerContact.trim());
	o_PaymentMethod = (i_PaymentMethod == null) ? "" : (i_PaymentMethod.trim());
	o_PaymentTerm = (i_PaymentTerm == null) ? "" : (i_PaymentTerm.trim());
	o_DeliveryMethod = (i_DeliveryMethod == null) ? "" : (i_DeliveryMethod.trim());
	o_DeliveryTerm = (i_DeliveryTerm == null) ? "" : (i_DeliveryTerm.trim());
	o_CustomerName = (i_CustomerName == null) ? "" : (i_CustomerName.trim());
	o_AddressLine1 = (i_AddressLine1 == null) ? "" : (i_AddressLine1.trim());
	o_AddressLine2 = (i_AddressLine2 == null) ? "" : (i_AddressLine2.trim());
	o_AddressLine3 = (i_AddressLine3 == null) ? "" : (i_AddressLine3.trim());
	o_AddressLine4 = (i_AddressLine4 == null) ? "" : (i_AddressLine4.trim());
	o_City = (i_City == null) ? "" : (i_City.trim());
	o_State = (i_State == null) ? "" : (i_State.trim());
	o_PostalCode = (i_PostalCode == null) ? "" : (i_PostalCode.trim());
	o_Country = (i_Country == null) ? "" : (i_Country.trim());		

20. Whatever comes in as order header details in the input XML, we have passed in to output parameters. However, these output parameters are local to the java function we just created; hence will not be able to use them in any other function in the mapping. Therefore we now need to assign these output parameters to a set of global parameters. To create a global parameter, right click  on Variables and Constants tab in Mapping Console → Create Variable.

Create Global Variable

21. Give proper name and a description for the variable. It would be a good practice to put a “g” in front of the variable to identify that it is global. In the same way, define all other required global variables as well.

Global Variables

22. Data type for all variables are set to String and initial value of the variable is set to blank.

23. Now we need to assign the output parameters from ReadOrderHeaderDetails java function to relevant global variables. We will first assign o_CustomerNumber to gCustomerNumber. For that click on gCustomerNumber, drag it and drop it on o_CustomerNumber.

Assigning Global Variable

24. In the same way assign all required output parameters to global variables.

All global variables assigned

25. Now we have read all header details from the input XML and create the customer order header inside M3. We can use OIS100MI – AddBatchHead API. We will add this API to the mapping. For that add M3 API tool under M3 Functions in toolbox to the sequence list area after the ReadOrderHeaderDetails function.


26. In the window that is opened, select a location to retrieve API details and click Next. (Make sure you have setup M3 API Connectivity in ION Mapper Preferences). This will retrieve the list of APIs from M3.

M3 API Connection

27. In the next window select the required API and click finish.

API List

28. This will add the API in to the mapping. Then click Select in toolbox.

API added to the mapping

29. Now we have to give inputs to this API. Drag gCustomerNumber variable and drop it on CUNO input of the API. This will assign the value in gCustomerNumber variable to CUNO input in the API.

30. In the same way connect other variables as well. We can define a global constant called gCompany, set value to a desired company number and assign that to CONO input of the API.

31. This API returns Temporary Order Number as an output and we need to store that in a variable, so that it can be used later in the mapping. For that, define a string global variable called gTempOrderNumber and assign that to ORNO output field of the API.

API Inputs and Outputs

32. In the same way, add OIS100MI – AddBatchAddress API to pass address details in to M3. In this case you will have to use gTempOrderNumber as an input. To provide ADRT input in the API, you will have to define another constant called gAddressType and set it to “1”.

Add Address

33. Now we need to add order lines to the order. There can be multiple order lines in an order. Therefore we need to execute OIS100MI – AddBatchLine API again and again for each order line coming in OrderLine nodes in the input XML. For that first we add a Loop to the Mapping. Loop tool is located under Core Functions in toolbox.

34. Then link OrderLine Node with the loop as shown below.


35. Go to Loop’s properties and check if Condition is set to Execute FOR EACH element. Give a proper name to the loop (OrderLineIterator).

Order Line Loop

36. We need to read order line details from the input schema. For that, add new java function in to the loop. Just like the ReadOrderHeaderDetails function, read line details from the schema and assign them to a set of global variables.

37. Then add OIS100MI-AddBatch API also in to the Loop and map the correct inputs.

Order Line Loop

38. Finally, we have to execute OIS100MI – Confirm to confirm the order inside M3. Assign the output fields to global variables.

OIS100MI - Confirm

39. If gStauts is 90, customer order has been correctly create in M3 and gOrderNumber should contain the firmed Customer Order number. If gStatus is 15, there is an error in the Order Header. If gStatus is 25, there is an error in the Order Lines. Now we need to map required detail output schema. For that first add a java function like below in to the Map.


40. Implement below code in the above java function.

private void mapOutputs() throws Throwable {
	o_Environment = "TEST";
	o_Entity = "CustomerOrder";
	o_Operation = "Create";
	o_CustomerPortalOrderId = i_CustomerPortalOrderId;
		o_OrderNumber = i_OrderNumber;
		o_Result = "OK";
		o_Message = "Customer Order was created successfully!";
	} else if(i_Status.equals("15")){
		o_OrderNumber = "";
		o_Result = "NOK";
		o_Message = "Error in Order Header. Check temporary order " + i_OrderNumber + " in OIS275.";
	} else if(i_Status.equals("25")){
		o_OrderNumber = "";
		o_Result = "NOK";
		o_Message = "Error in Order Lines. Check temporary order " + i_OrderNumber + " in OIS275.";
	} else {
		o_OrderNumber = "";
		o_Result = "NOK";
		o_Message = "Error ocurred. Check temporary order " + i_OrderNumber + " in OIS275.";

41. Finally map output parameters in MapOutput Function in to output schema.

Map Outputs

42. Save the mapping. Then we need to validate the mapping to see if there are any errors. For that right click on the mapper → Validate. If there are no errors you will see a green light in Mapping Console area.


Publishing and Activating a MEC Map

1. Open the MEC Map that you need to add in to the server.

2. First we need to save the mapping to the MEC database. For that right click on the mapper → Save.

3. In Mapping Database window, select the MEC database you want to save the mapping to and click Finish


4. If the mapping is saved to the database successfully, you will see a green light in Mapping Console.

Green Light

5. Then we need to generate this mapping and publish it, so that it can be used in a XML transform process. Right click on the mapper → Generate, then Publish. If there are no errors, you will again see a green light in mapping console area.

6. After the MEC Mapping is published in the server, it should be activate that. For that go to MEC Management Pages in LCM.

7. Then go to Server → Mappings tab, find your MEC mapping in the list and click Activate.

Activating a Mapping

Using a MEC mapping in Partner Agreement

1. Once the MEC mapping is published and activated go to the Process tab of the Partner Agreement where this MEC mapping should be used. We will use the CustomerOrderCreate Agreement that has already been setup.

2. Add XML Transform process to the process list.

XML Transform Process

3. In Configuration for XML Transform window, select the required MEC Mapping for the transform and an API reference to execute APIs in the Mapping. Then click OK.

XML Transform Configuration

4. Make sure that XML Transform process is placed between Archive and Send process. Then add another archive process after the XML transform. Final list of processes look like below.


5. Save the Agreement.

Drop this XML in to the input channel (change the data in the XML to match your M3 configuration) and if the Customer Order is created in M3 without any issue, you should get below output.

			<Message>Customer Order was created successfully!</Message>

If this works, you have completed your first MEC mapping successfully.

Have a nice day…

Installing MEC Mapper

MEC Mapper is an Add-in that is installed in Eclipse IDE.

1. Download the latest version of Eclipse from this link and install it in a location where it does not spaces in the file path. In my case it is going to be C:\Development\Infor\MEC\MECMapper.

2. Then download the latest MEC mapper add-in from infor download center.

3. Open Eclipse and select a workspace. I am using C:\Development\Infor\MEC\Projects\Lankeshawara as my workspace.

4. Once eclipse IDE is opened, go to Help → Install New Software.

Install New Software

5. In Install window, click Add.


6. In Add Repository dialog box click on Archive and locate the MEC mapper plug-in. Then click OK. This will list the ION Mapper (MEC Mapper) in the grid. Select it and click Next.

ION Mapper install

7. In the next window it will show you Install Details. Click Next.

8. Next window will ask you to Review the license, accept the license agreement and click Finish. Eclipse will then install the plugin and ask you to restart eclipse once the installation is completed.

9. Once eclipse is restated go to Windows → Preferences.

10. In Preferences window click on ION Mapper.


11. As soon as you click on ION Mapper, eclipse will ask to setup a password. If not click on Set New Password to setup a password.

12. In XML Editor, give the path of your favourite text editor. In my case i am using Notepad++.

External Text Editor

13. Then expand ION mapper and setup Database Connectivity, M3 API Connectivity, Server Connectivity and SQL Connectivity. You should be able to find all the data required to setup these connections in the exit document provided by the technical consultant who did the server installation.

Server Details

14. Click OK and exit from the Preference window.

15. Now we need to change the perspective of eclipse. For that go to Windows → Perspective → Open Perspective → Other.

Open Perspective

16. In Open Perspective window, select Mapping Development and click OK.

List of Perspectives

This will change the perspective of Eclipse to MEC Mapper like below. Now you are ready to start developing MEC mappings.

MEC Perspective

Have a nice day….

MEC Part 5 – XML Transform Process

So far we have looked at how to configure an input channel, output channel and a partner agreement. In this post we will look at how to perform some task based on the message received from the from an external application. For this we can XML transform process in MEC processes.

The scenario we are using in this series of posts is an integration between a 3rd party Customer Portal and M3. The first integration is creating a customer order inside M3 using the details coming from the application. Format of the Customer Order Creation Request looks like below.



This request is identified using XML detection and the content within RequestBody node is passed in to XML transform process (how this is done is discussed in my previous post). The format of the XML that is going in to XML Transform process looks like below.

        <CustomerContact>Mr. James George</CustomerContact>



What XML transformation does is, it takes XML input, performs some tasks based on the content in the XML and generates an output file if required. XML transformation is done by a MEC mapping and that can be developed using MEC Mapper (ION Mapper), which is an add-in for Eclipse IDE that Infor has released along with the MEC package.

In this example, the XML transform process should read the above input XML, create the customer order inside M3 and then output the Order number of the customer order created. The format of the output XML file looks like below.

            <Message>Order was created successfully</Message>


Based on above input and output XML formats, we need to first develop respective XML schema (refer W3Shcools to learn more about XML schema), because MEC mapper requires XML schema to develop mapping.

I have given the input and output XML schema for customer order creation MEC mapping below and we are going to use these two in our next post to develop our very first MEC Mapping.

Until next time… Have a nice day…

MEC Part 4 – XML Detection

In my previous post we learnt how to set up a partner agreement and we used channel detection to identify the input file and trigger a MEC process.

Channel detection is really useful in integrations where the 3rd party application does not have the capability of generating customized XML files or only has the capability of generating flat files. However, this detection method becomes little bit inconvenient, if there is a huge number of different integration points. Then for each integration point, separate input channel should be configured (separate input folders as well) and managing a huge number of input channels would become a nightmare.

But, what if we can read the data inside the input XML file and detect the file and trigger different MEC agreements based on its contents. It would be really cool, isn’t it? Partner Administrator provides this capability through XML detection.

Consider below XML that is coming from the Customer Portal (example from previous post).



Let’s assume that customers can update their address details from the customer portal. These address details are updated in M3 through MEC. In this case, MEC should be able to differentiate a Customer Order Creation request from a Delivery Address Update Request. We can easily do this using XML detection based on the values in Environment, Entity and Operation nodes. We can pass Address in Entity node and Update in Operation node.



For this first we need to create a new XML Target Group.

Creating New XML Target Group
  1. Go to Partner Administrator Tool and go to Manage → Detections


2. In Detections window go to Targets → XML tab. Here we need to define absolute Xpaths of the nodes (XML Targets) that we are going to use for XML detection. Click New.

Detections Window

3. First we create a XML target for Environment node. In Create New Target window, enter the name as cp:env (you can enter any name here). In the Path textbox enter the absolute Xpath to the Environment node (/CustomerPortalRequest/RequestHeader/Environment). Click OK.


4. In the same way, create XML targets for Entity and Operation nodes as well.

  • cp:entity – /CustomerPortalRequest/RequestHeader/Environment
  • cp:operation – /CustomerPortalRequest/RequestHeader/Operation

5. Now we need to define a Target Group by adding the above XML targets together. Go to Target Groups → XML tab and click Create Group.

Create Group

6. In Create New Target Group window, give the group a name and a description. Then click Create.

Create New Target Group

7. Once the target group is created, we need to add targets to it. For that, add required targets from unused targets.


8. In this case add all three targets we created in step 3 and 4. Then click Save.

Selected Targets

9. Now we need to add this newly created Target Group to the XML Detection List. Go to Detection Order Tab and add CustomerPortal_Detection to XML Detection List. Click Save.

Note: Make sure that your detection group is not shadowed by any other existing target group by changing the Detection order as required. Let’s say we created another target group (CustomerPortal_Detection_01) using only cp:env and cp:entity targets. This new target group should be placed after CustomerPortal_Detection target group in the order, unless CustomerPortal_Detection target group will never be reached during a detection since it is shadowed by CustomerPortal_Detection_01.

Adding the Target Group to XML Detection List

10. Close the Detections Window and go back the Partner Administrator.

Now you are ready to use this newly created XML Detection Target Group in your Partner Agreements.

Creating a Partner Agreement Using XML Detection

1. Create a new Partner Agreement.

2. In Detection Tab under XML Detection Click on CustomerPortal_Detection.

3. Then put Target Values for each XML target of the Target Group. In this case we need trigger current Partner Agreement for the New Customer Order Creation request. Therefore, according to the  format of Customer Order Creation Request, cp:entity and cp:operation should be set to CustomerOrder and Create respectively.

Set Target Values

4. In Body Element Xpath, you can define which part of the input XML should be used in XML Transform process (This will be discussed in the future). In this case, I need only the content in RequestBody node. Therefore, I will put /CustomerPortalRequest/RequestBody as the Body Element Xpath and click Save.

Body Element Xpath

5. Add Archive and Send processes in Processes tab (refer the previous post). Drop the attached XML file in to the input channel that we configured in one of the previous posts.

Note: If XML Detection is used, it is not important to which input channel the input files are dropped. If MEC can find a agreement with correct XML Target Values, it will be triggered.

In the next post we will see how to update M3 using the messages coming from external applications.

Have a nice day…

MEC Part 3 – Creating a New Partner Agreement (with Channel Detection)

In my previous 2 posts we learnt how to set up receive (input) and send (output) channels. We are using an integration between a 3rd party customer portal and M3 as the scenario for this article series as I mentioned in my very first post on MEC.

The first integration point of that integration is Creating the Customer Order in M3 based on the details coming from Customer Portal. Let’s assume that Customer Portal is sending this XML as request to create the Customer Order in M3. Now we will drop this XML file in to the receiving channel we created (CustomerPortal\Inbound) and see what happens. As soon as the XML file is dropped in to the receiving channel, MEC picks up that file and the file gets disappeared. Now we can monitor, what has happened to that file in LCM.

Monitoring MEC Messages
  1. Go to LCM → MECDEV → Manage Application.

2. In Grid Management Pages, go to Message Tab.

3. The state of the last message that MEC has received is “Detect Failed”.

Detect Failed

4. We will go inside this message to see the input file that caused this error and make sure that it is the file that we just dropped in. Click on Show link in the message.

5. In Message Details page click on view button to see the .rcv file. This will show you the XML file that has triggered this MEC message.

View Message

You get this Detect Failed error when MEC does not know what to do with the file that it has received. That is why we need to create a Partner Agreement, to tell MEC what to do when a file is received.

Setting up a Partner Agreement with Channel Detection
  1. Go to Partner Administrator.

2. Right click on the Partner Agreement Pane and click on Insert Group. Give group a name (Customer Portal)

Insert Group

3. Right click on the newly created agreement and click on New Agreement.

Create New Agreement

4. Once the new agreement is added, change the basic details of the agreement.

Basic Agreement Details

5. Then go in to Detection Tab. In Detection tab we define how a MEC agreement identifies if it should be triggered when a request comes in to MEC.

6. In this case we will use Channel Detection. For that click on Channel Group under Channel Detection. Then select the receiving channel you need from the list. In this case it is Customer Order Inbound channel. What this means is, whenever a file is dropped in to CustomerPortal\Inbound folder, this MEC agreement is triggered.

Channel Detection

7. Once the detection method is set, go to Processes tab. This is where we define what to do when this partner agreement is triggered. Here we are not going to perform any complex tasks, but to archive the received message and send the same file in to the output folder we created.

8. To add the Archive Process, right click on the Processes box and select Archive.

Archive Process

9. To save the file from the previous process in to output folder, add Send Process. In the Configuration for Send window, select the relevant Send Channel and set the encoding method for the output file.

Send Process

10. Now your process tab should look like below.

List of Added Processes

11. Save the Partner Agreement and restart MEC component from LCM.

12. Once MEC component is restarted, go in to the Message details that had previously failed and click on Redetect or drop the XML request again into input folder.

13. Then check the MEC Messages in LCM, and this time the state should be “Finished”. Further, you will be able to see which agreement has picked up this message.

New Mec Message

14. In the output folder you should see a new XML file which has been created by the send channel. If you open that file, you will notice that it is similar to the input XML, because we directly sent the input file to the send channel.

In the next post we will discuss about a different detection method.

Have a nice day…

MEC Part 2 – Setting Up a Send Channel (using DISK Protocol)

In my previous post we looked at how to setup a receiving channel. In this post we will look at how to set up a send channel.

Infor has provided several protocols to setup Send channels. In this post we will look how to setup a send channel using DISK protocol. That is, output file is saved to a given folder.

  1. First we need to create a folder in the desired location. In this case I am going to create the output folder (Outbound) also in the MECDEV\CustomerPortal directory that I created in my previous post. It is not mandatory to create the Output folder inside MEC installation directory.

2. Then share the output folder with everyone using folder Properties → Sharing → Share.

3. Now open the Partner Administrator tool  and go to Manage → Communication.

4. In Communication window, go to Send Tab → New.

Send Channel

5. Give channel a name, set the protocol as DISK and give the path of the output folder. Then click OK.

Once the send channel is created, there is NO need to restart MEC component in LCM. Now you have finished setting up your very first output channel. In the next post, we will look at how to create a new partner agreement to integrate M3 with Customer Portal.

Have a nice day…