Search This Blog

Monday, October 24, 2011

Extract Message from Exception infolog and Log into the ExceptionTable

Gets the Message from the Exception and Store into table.

public void writeInfoLogData(str ExceptionLogged,InfologData _infologData,str _orderId)
{
       SysExceptionTable               exceptionTable;
    SysInfoLogEnumerator            infoLogEnum;
    SysInfologMessageStruct         infoMessageStruct;
    EDSACRMSyncExceptionLog  CRMSyncLog;
    str  ExceptionMessage;
    ;
    infoLogEnum = SysInfoLogEnumerator::newData(_infologData);
    while(infoLogEnum.moveNext())
    {
        //Extract the message from the string
        infoMessageStruct = SysInfologMessageStruct::construct(infoLogEnum.currentMessage());
        ExceptionMessage +="\n" + infoMessageStruct.message();
    }
    CRMSyncLog.clear();
    CRMSyncLog.initValue();
    CRMSyncLog.ExceptionId=ExceptionLogged;
    CRMSyncLog.ExceptionTxt=ExceptionMessage;
    CRMSyncLog.RefOrderId=_orderId;
    CRMSyncLog.insert();
}

Call from job

static void krishh_LoadMessageFromException(Args _args)
{
    SalesTable salesTable;
    InfologData         infoData;
    AifInfoLog          aifInfoLog;
    container           infologData;
    ;
        infologData = connull();
    try
    {
        aifInfoLog = new AifInfoLog();
        salesTable.clear();
        salesTable.insert();
    }
    catch(Exception::Error)
    {
        infologData = aifInfoLog.getInfoLogData();
        EDSA_CreateSalesOrder::writeInfoLogData('SalesTableCreation',infologData,'10334');
    }
}

No comments:

Post a Comment

Thanks for visiting my blog,
I will reply for your comment within 48 hours.

Thanks,
krishna.