I found something strange when I want to validate ItemId on a salesLine. The scenario is as follows:
I use a DataEventHandler to subscribe to the ValidatedFieldValue event, as such:
class TEST_Table_SalesLine
{
[DataEventHandler(tableStr(SalesLine), DataEventType::ValidatedFieldValue)]
public static void SalesLine_onValidatedFieldValue(Common sender, DataEventArgs e)
{
SalesLine salesLine = sender;
ValidateFieldValueEventArgs err = e;
FieldName fieldName = err.parmFieldName();
switch (fieldName)
{
case fieldStr(SalesLine, ItemId):
warning("TEST!!!!");
break;
}
}
}
This should throw a warning with the text "TEST!!!!" when I modify the ItemId. In fact it does, but ONLY when I enter the exact correct cased ItemId. For instance in contoso usmf I have ItemId A0001. When I enter A0001, the warning pops up, but if I enter a0001 (lowercase a), it doesn't! In AX2012 that didn't matter, and in most cases in D365 it doesn't matter, because it will automatically be replaced by A0001, but in this case the warning is not thrown!
I've tried all kinds of event handlers (textchange, modifiedField) and even delegates and overlayered code, but the behavior stays the same.
I think this is a bug, or am I missing something in plain sight?