Automating the Triggering of a Process Flow using M3 Field Audit Trail

Vincent Tabone from Australia has come up with an innovative solution to trigger PFI flows from Field Audit Trail. Here below are Vincent’s screenshots and instructions.

 

  1. Create a Field Audit Trail (FAT) file as shown below.List which schema/file is on FAT:

    The FAT history file, which auto job is monitoring:

     

  2. Create an autojob.The autojob is to run as frequent as required (this is described on the following page). The autojob will determine if there are records ready to process and will trigger the process flow.
  3. Add Auto job in MNS051:

The source code for the autojob is not provided here.

Basically, Autojob will copy and delete the records from FAT file(if there is any) to work file(ZZCUWK) and then go through the records in work file to trigger PFI. The records in work file will also be deleted after trigger PFI. The source code contains the following:

  • ZZCUMA – File that is being monitored by the FAT file
  • ZZCUWK – Work file, which the autojob is checking to determine which records need to be processed
  • ZPFIPOC – PFI trigger auto job
  • ZPFIPOCCL – PFI trigger auto job CL
  • ZTRGPFI – This is just to test the trigger of PFI. Hard coded the value.

The java code is for the autojob which contains the code to trigger the flow:

public void startPFITrigger() { 
    trigger.setFlow("M3CustomerAppV5");
    trigger.addVariable("LSOProfile","MAD");
    trigger.addVariable("Company", ZCUWK.getCONO());
    trigger.addVariable("CustomerNumber", ZCUWK.getCUNO());
    trigger.fire();
    KQLOG.I(trigger.getMessage());
}

You also need to have these in movex.properties:

user = mdir.getParameterString("app.pfi.user", "put value in movex.properties");
pwd = mdir.getParameterString("app.pfi.password", "put value in movex.properties");
enabled = mdir.getParameterString("app.pfi.enabled", "true").equalsIgnoreCase("true");

 

Special thanks to Vincent for sharing this solution!