Errors

The Date Value is not a Valid Date

Error:
'The [DATE] value is not a valid date.'

Cause:
The error occurs when NAV server and Web server have different regional settings (date format).

Symptoms:
NAV gives an error when placing an order because the requested delivery date is in the incorrect format and when filtering pending orders by order date.

Solution:

  • Open the codeunit 11123308 'SC - XML/System Functions' in design mode;
  • Locate the 'ConvertStringToDate' function;
  • Add 3 local variables of the 'Integer' type to this function: 'YearInt', 'MonthInt' and 'DayInt';
  • Replace the function code by the following implementation:
    IF StringDate <> '' THEN BEGIN
      IF EVALUATE(DateValue,StringDate) THEN
        EXIT(DateValue);
      IF EVALUATE(DateTimeValue,StringDate) THEN
        EXIT(DT2DATE(DateTimeValue));
      IF EVALUATE(MonthInt,COPYSTR(StringDate,1,2)) AND
         EVALUATE(DayInt,COPYSTR(StringDate,3,2)) AND
         EVALUATE(YearInt,COPYSTR(StringDate,5,4))
    THEN
     IF EVALUATE(DateValue,FORMAT(DMY2DATE(DayInt,MonthInt,YearInt)))THEN
          EXIT(DateValue);
      ERROR(Text11123317,StringDate);
    END;
  • Recompile the codeunit.

Related to:
Sana Commerce - NAV Connector
Sana Commerce - SQL Provider with interfaces