web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Due date alert batch job.

(0) ShareShare
ReportReport
Posted on by 29

Hi,

I created an alert rule in the purchase agreement, however, we are getting the below error in the due date alert batch job.

AlertRuleError.JPG 

Microsoft.Dynamics.Ax.Xpp.ErrorException: Exception of type 'Microsoft.Dynamics.Ax.Xpp.ErrorException' was thrown.
at Dynamics.Ax.Application.EventTypeDue.dueDays2date(EventDueDays dueDays, Object curDate, Boolean add) in EventTypeDue.dueDays2date.xpp:line 196
at Dynamics.Ax.Application.EventTypeDueIn.Setdatefilter(Query query) in EventTypeDueIn.setDateFilter.xpp:line 13
at Dynamics.Ax.Application.EventProcessorDueDate.Processrule(EventRule _eventRule) in EventProcessorDueDate.processRule.xpp:line 62
at Dynamics.Ax.Application.EventProcessorDueDate.Run(EventRule eventRule) in EventProcessorDueDate.run.xpp:line 14
at Dynamics.Ax.Application.EventJobDueDate.runDueDateEventsForUser(Object[] _args) in EventJobDueDate.runDueDateEventsForUser.xpp:line 48
at EventJobDueDate::runDueDateEventsForUser(Object[] )
at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] parameters)
at Microsoft.Dynamics.Ax.Xpp.PredefinedFunctions.runas(String userId, Int32 classId, String staticMethodName, Object[] parms, String company, String language, String partitionKey)
at Dynamics.Ax.Application.EventJobDueDate.Run() in EventJobDueDate.run.xpp:line 24
at Dynamics.Ax.Application.BatchRun.runJobStaticCode(Int64 batchId) in BatchRun.runJobStaticCode.xpp:line 54
at Dynamics.Ax.Application.BatchRun.runJobStatic(Int64 batchId) in BatchRun.runJobStatic.xpp:line 13
at BatchRun::runJobStatic(Object[] )
at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] parameters)
at BatchIL.taskThreadEntry(Object threadArg)

The alert rule created is below :

AlertRule.JPG

I tried to compile the system after deleting the Xpp folder, run full compilation without any luck, any advice please ?

Regards,

Ali Chehade

*This post is locked for comments

I have the same question (0)
  • Ajit Profile Picture
    8,755 on at

    Have you generated CIL?

  • Martin Dráb Profile Picture
    238,281 Most Valuable Professional on at

    If generating CIL doesn't solve the problem, look at what code is at line 196 of EventTypeDue.dueDays2date(). If the problem isn't obvious from looking at code, use the debugger to see what's happening at runtime.

  • Ali Chehade Profile Picture
    29 on at

    Yes,i did it with the same result

  • Ali Chehade Profile Picture
    29 on at

    Hi Martin,

    I added an info log in EventTypeDue.dueDays2date(), I found that the dueDays parameter is empty, any suggestion here?

    Thanks.

  • Martin Dráb Profile Picture
    238,281 Most Valuable Professional on at

    No, the error is indeed thrown at line 196 in EventTypeDue.dueDays2date() not in EventJobDueDate.run(). You can see the sequence of calls in your first screenshot.

    I think your problem is that you don't know how to debug the code. The documentation will help you: Debugging in Microsoft Dynamics AX 2012 > X++ Code > X++ Code that Calls runAs.

  • guk1964 Profile Picture
    10,888 on at

    Apart from debugging....

    Is there message in the event log?

    Does it run from another client?

    Does it run  OK if  you run it manually from the tutorial?

    Try a shorter time period.

    Try expressing the time in days

    Check your client and server kernel versions are the same and that those are = to or higher than the app

     -

    In general I'm a wary of due date alerts because they update 5 tables, and there are often multiple transactions to review in a busy system. A weekly exception report is more useful in most cases. There is a related report in the public module for sun contractors form whcih you could maybe utilize the logic..

  • Ali Chehade Profile Picture
    29 on at

    Hi,

    Now I am getting the below error :

    800385.Capture.PNG 

    Thanks.

  • Mirko1 Profile Picture
    10 on at

    Now same error here,

    debugged the CIL

    - Visual Studio > Debug AX32Serv

    - lead symbol request to Program Files \ Microsoft Dynamics AX \ Server \ AX \ bin \ XppIL,

    now I found an error in class method EventTypeDueIn.setDateFilter(),

    where in line

    qbr.value(queryRange(this.parmStartDate() - EventTypeDueSince::maxDays(),this.newDate()));
    

    a query value, but after this an additional query range will be created for validTimeState:

    query.validTimeStateAsOfDate(EventTypeDue::dueDays2date(this.parmXValue() + 1, this.parmStartDate(), true));
    

    but our table PurchAgreementHeader does not have validTimeState activated.

    This happens twice, delete the two lines 'query.validTimeState..', in D365 they are gone as well.

    Second issue:

    In my eyes the isMatchingRule() (not only) in this class is incorrect, I exchanged

    return EventTypeDue::dueDays2date(this.parmXValue(),DateTimeUtil::date(DateTimeUtil::applyTimeZoneOffset(eventRule.CreatedDateTime,DateTimeUtil::getUserPreferredTimeZone())),true) <= this.bufferDate();

    with

    return EventTypeDue::dueDays2date(this.parmXValue(), DateTimeUtil::date(DateTimeUtil::getSystemDateTime()), true) >= this.bufferDate();

    twice for cases Types::Date and UtcDateTime.

    Explanation:

    The called method adds a value (f.i. 4 days) to a comparation date (today) and compares is to bufferDate = purchAgreement.DueDate.

    The creation date of the event rule in standard code would be correct, if the rule itself would be created every day again, but in my case it's not.

    Every day the eventRule recored is taken and it's date goes into the comparison - must be wrong.

    I tested a rule on several days, but it wasn't created again.

    Even the original comparison operator 'Date today' <= 'Due date of purchAgreement' couldn't be correct in my understanding.

    Anyhow, with the modified code it works for me and the customer and maybe will help someone else.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
TAHER Mehdi Profile Picture

TAHER Mehdi 3

#2
Nakul Profile Picture

Nakul 2

#2
Mea_ Profile Picture

Mea_ 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans