BP-The implicit conversion from Date to UtcDateTime is not supported

Hi all,

I’m working on Dynamics 365 for Finance and Operations Update 11.

I’m facing the best practice deviation “The implicit conversion from Date to UtcDateTime is not supported” when running the below piece of code.

salesLine.AftermarketExpiryDate = DateTimeUtil::date(DateTimeUtil::addDays(salesLine.AftermarketWarrantyDate , 365));

Both AftermarketExpiryDate and AftermarketWarrantyDate are Date fields.

Please suggest a fixture for this.

The line of code does quite a few things; you should identify where exactly it’s happening.

I think it’s at DateTimeUtil::addDays(salesLine.AftermarketWarrantyDate, 365), because addDays() expects a UtcDateTime value and you’re providing a Date instead.