Trigger PFI flows via EPC

As a reminder, there is a solution to trigger ProcessFlow Integrator (PFI) flows using External Program Connector (EPC) to avoid modifications to M3.

One traditional solution to trigger PFI flows from M3 is to make small modifications to the M3 Java source code with MAK. It only takes a few extra lines of code to trigger a PFI flow when an event happens in M3, for example when a new Customer is created in CRS610 or when an Item is changed in MMS001. But this solution is intrusive as it requires a modification to M3 which we strive to avoid to minimize maintenance.

Instead, we could use EPC. EPC is a reverse API where M3 sends XML messages to EPC on events such as Create, Change, and Copy. For that, we setup a Subscriber in EVS040, a Remote Server in EVS038, and a Subsystem Job in MNS051. Then we develop an EPC plugin in Java, outside of M3, to process the XML messages and to trigger the PFI flows. This new solution is non intrusive as it avoids modifications to the M3 source code. However, it requires the configuration of several M3 programs and the development of an EPC plugin in Java.

If anybody is interested in the EPC solution, please contact me for details.

Note: There is also a solution to trigger FPI flows via Field Audit Trail.

Published by

thibaudatwork

ex- M3 Technical Consultant

16 thoughts on “Trigger PFI flows via EPC”

  1. Hi Thibaud,

    I’d like to learn more about using java and epc. Can you suggest some resources please?

    I’d like to write a procedure to receive xml pushed from M3 if possible.

    Regards,

    Martin

    Like

    1. Hi Martin, in the context of a project I can show you how to use EPC and Java. Know that EPC has been made obsolete by EventHub and EventAnalytics; I can show you that as well. Where are you located? I will be traveling soon. Send me an email. Check my contact info on thibaudlopez.net.

      Like

  2. Hi Thibaud,

    Do you have a blog related to Trigger IPA flows via M3 Java (MAK)?

    I would like ask for you help regarding the issue we are currently encountering.

    We created a trigger logic using cPFIAsyncTrigger2 in PPS200 via JAVA (MAK) and we also set up the M3BE properties (PFI properties).

    After we ran PPS200, we got an exception error below:
    “com.lawson.grid.proxy.ProxyException: Null Proxy for: com.lawson.bpm.eprocessserver.interfaces.TriggerFlow DataArea: ”

    The error occurred on the LPSSession.createGridSession(server,port,user,pwd,theDataArea) line.

    I am not sure how we got this error, we tried to solve this by updating the M3BE properties (app.PFI properties) but still not working.

    Maybe you have an idea on how to solve this problem.

    Apologies if I posted on this post.

    Regards,
    Cy

    Like

    1. Kumusta Cyrillus,

      There is some documentation at this URL: https://lawson-lsaprod.hmc.hurleymc.com/help/topic/com.lawson.help.administration/com.lawson.help.lpaag-uw_10.1.x/L44979771854123.html

      And here is some old M3 Java code from 2007 which I do not know if it still works:

      package mvx.app.pgm.customer;
      
      import mvx.app.util.cPFIAsyncTrigger;
      import mvx.app.common.*;
      import mvx.runtime.*;
      import mvx.db.dta.*;
      import mvx.app.util.*;
      import mvx.app.plist.*;
      import mvx.app.ds.*;
      import mvx.dsp.common.GenericDSP;
      import mvx.dsp.obj.*;
      import mvx.util.*;
      
      public class CRS610 extends mvx.app.pgm.CRS610 {
          public void PEUPD() {
              super.PEUPD();
              cPFIAsyncTrigger trigger = new cPFIAsyncTrigger(this);
              trigger.setFlow("HelloWorld");
              trigger.addVariable("message", CUSMA.getCUNO());
              trigger.fire();
              trigger.getMessage();
          }
      }

      Like

    2. I think the code you were trying to use is for triggering flows from within a grid application which is not your case, hence the failure. Instead, try the M3 code I just pasted above.

      Like

      1. Thanks for the reply Thibaud. Our client is currently using version 13.

        Unfortunately, the one you pasted above didn’t work as well.

        We only rely to this document from Infor and they are requiring us to configure the movex.properties for the trigger to work and use cPFIAsyncTrigger2 instead of cPFIAsyncTrigger

        Here is the link:

        https://docs.infor.com/help_lmrk_cloudsuite_10.1/index.jsp?topic=%2Fcom.lawson.help.administration%2Fcom.lawson.help.lpaag-c_10.1.1.x%2FL44979771854123.html&resultof=“M3″%20″m3″%20

        We are trying to fix this for more than 2 weeks now. 😦

        Like

  3. Hi Thibaud,

    Sorry for the confusion., Let me summarize it again.

    The createGridSession was implemented under cPFIAsyncTrigger2 via fire() function.

    Here is a snapshot of the logic we used in the program PPS200 (via java MAK)

    //declaration
    public cPFIAsyncTrigger2 PFItrigger = new cPFIAsyncTrigger2(this);

    //this is the code to trigger the flow
    PFItrigger.setFlow(“M3PurchOrdApp”);
    PFItrigger.addVariable(“Company”, PHEAD.getCONO());
    PFItrigger.addVariable(“Division”, PHEAD.getDIVI());
    PFItrigger.addVariable(“Whouse”, PHEAD.getWHLO());
    PFItrigger.fire();

    This is where there error occurred when we debugged the fire() function
    LPSSession.createGridSession(server,port,user,pwd,theDataArea)

    We tried the code you pasted above and during testing, we got the following error

    Here is our code
    //declaration
    public cPFIAsyncTrigger PFItrigger = new cPFIAsyncTrigger(this);

    //this is the code to trigger the flow
    PFItrigger.setFlow(“M3PurchOrdApp”);
    PFItrigger.addVariable(“Company”, PHEAD.getCONO());
    PFItrigger.addVariable(“Division”, PHEAD.getDIVI());
    PFItrigger.addVariable(“Whouse”, PHEAD.getWHLO());
    PFItrigger.fire();

    And here is the error

    java.lang.Exception: Error: Unable to lookup RMI object rmi://USHQIPATST.na.acushnetgolf.com:10815/dbSecurity
    error during JRMP connection establishment; nested exception is:
    java.io.EOFException

    java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
    java.io.EOFException

    Cy

    Like

    1. Oh so the only difference in the two codes is the number 2? I don’t know. You can keep debugging the createGridSession and drill down (mostly decompiling) until you find the error, that will take some time, or create a Infor Xtreme incident, and wait for help.

      Like

    1. Karthick,

      I am not experienced with SSIS, but I should explain my thinking.

      There are only three known entry points to import/export M3 data:

      1) Direct to database with SQL offers the most flexibility to export data (SELECT FROM WHERE) from any table in any possible way, and is the fastest; but import (INSERT INTO, UPDATE, DELETE) is forbidden because of the risk of messing up M3.

      2) Direct to M3 Business Engine with M3 API offers guaranteed integrity of the data, i.e. M3 will protect itself and will reject invalid data; and it is bidirectional import/export; but it only covers a fraction of M3, i.e. there is not an API for everything in M3.

      3) Direct to M3 Business Engine with BCI is used by M3 Web Services (MWS) of type M3 Display Program (MDP); and it is also bidirectional import/export; but there is no client for it except MWS Designer which is not publicly programmable.

      4) I don’t remember if the user interface uses BCI or MEX.

      All other entry points are a derivative of those.

      In your case, your question is, given destination SSIS, what is the best M3 export strategy?

      I think SQL is the best because it is closer to SSIS than the other entry points, i.e. you can move data with SQL from M3 directly into SSIS; supposing M3 is also in SQL Server; and supposing you know the SQL queries to extract what you need; the query is not necessarily evident for joins and calculated values, in which case M3 API is preferable.

      Otherwise, use M3 API to export, and use SSIS to import.

      Otherwise, export with BCI (good luck!).

      Hope it helps,

      –Thibaud

      [edited for clarity]

      Like

Leave a comment