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.