Tuesday, 13 March 2018

Delete AIF exception logs

Here we are going to learn, how to delete AIF exception logs that are created before some xxx date.

static void MK_ClearAIFLogs(Args _args)
{
    SysExceptionTable  aiflog;
    ;
    ttsbegin;
    delete_from aiflog where
    aiflog.createdDateTime <  datetobeginUtcDateTime(today()-30, DateTimeUtil::getUserPreferredTimeZone());
    ttscommit;
}

There are few points to be noted about the above code.
1. The AIF exceptions are stored in SysExceptionTable.
2. How to use date and time range in the select query
3. Set set based statement. (Speeding Up SQL Operations)


No comments:

Secure API Integration in D365FO Using OAuth2 and Azure Key Vault (X++)

  Secure API Integration in D365FO Using OAuth2 and Azure Key Vault (X++) Integrating with external APIs securely is a common requirement in...