Calling modifiedField from the X++ code in AX2012

Hi

In previous version of AX this wasn’t popular to call directly from the code table.modifiedField as it was considered a method called from UI only. In AX2012 I see this approach being used much more often.

Recently I’ve tried to reuse the std logic that populates the receipt delivery dates on SL lines based on shipping date from X++ code in my class like below:

SalesLine.ShippingDateConfirmed = myDate;

SalesLine.modifiedField(fieldNum(SalesLine, ShippingDateConfirmed ));

But unfortunately this doesn’t work for some reason it - code goes into AXSalesLine class and calls million of methods , I’m lost (there are no customizations in our code)

Are there any restrictions on using modifiedField from code?