Sunday, November 16, 2014

MEC How to Get the Last API Name, Status and the Error Message

Recently, I've been working with Logging API errors using another custom M3 API (CRKR03) as a part of MEC development. Some API's had returned NOKs with additional white spaces i.e. TABS and Spaces exceeding the field (MESG) length of the CRKR03 that we have used to log errors.

First, let me explain how I've received the API NOK message by setting the ErrorHandling Property of the M3 API to Ignore M3 NOK.


if(!isLastAPICallOK() && getLastMIProgram().trim().equals("PDS001MI"))
{
    g_ErrorMessage = getLastAPIMessage().trim().replaceAll("\\s+", " ");
    ........ 
}  
Some API NOK messages are like the below (Note the additional white spaces)
'Item number 010411 does not exist                     
                                            
                                            
                                            
              WIT0103          ' 

Monday, November 10, 2014

Get the Inbound Trigger File Name

This article describes how to receive the inbound trigger file name (when using the Disk-in channels mode) using the code.

You can cross-verify the trigger file name by observing the archived manifest from the LifeCycle Manager.
 

Then locate the below value :



You can use the below code to get the trigger file name inside the mapper. (g_ProcessFileName is a string type global variable).

 g_ProcessFileName = getManifestInfo(ManifestConstants.COM_FILENAME);


Similarly, You can get most of the fields shown in manifest by using the getManifestInfo method and the ManifestConstant class. Please note that the ManifestConstants only contains the name of the key/attribute.

Get the UUID of the MEC Process

Recently, We were asked to log the MEC errors to a custom API. MEC process ID was required to be passed into this API as an input parameter.

You can verify the UUID from the LifeCycle Manager.


Using the below code, we could retrieve the UUID inside from the MEC mapper. (g_MapUUID is a global variable)
 g_MapUUID = com.intentia.ec.mapper.Mapping.this.strUUID; 

this variable can be even directly access as below.
 g_MapUUID = strUUID; 

or you can get this by using the manifest and global.
g_MapUUID = getManifestInfo(ManifestConstants.CMN_UUID); 

Please note that the ManifestConstants class contains only the names of the properties.