calculate plan error

I am getting an error “Date is not valid” when running the Calculate plan on the Order planning. Nothing has changed on the system and this has been working. Any Ideas as to what might have caused this issue?

I did a debug and this is where it is pointing the error happened.


CalendarEntry.SETCURRENTKEY(“Capacity Type”,“No.”,“Ending Date-Time”,“Starting Date-Time”);

CalendarEntry.SETRANGE(“Capacity Type”,CapType);


CalendarEntry.SETRANGE(“Ending Date-Time”,0DT,CREATEDATETIME(ProdEndingDate + 1,ProdEndingTime));

CalendarEntry.SETRANGE(“Starting Date-Time”,0DT,CREATEDATETIME(ProdEndingDate,ProdEndingTime));

Try this function for the SETRANGE:

CalendarEntry.SETRANGE(“Ending Date-Time”,0DT,CREATEDATETIME(CALCDATE(’<+1D>’,ProdEndingDate),ProdEndingTime));

Where exactly would I put that in the system. Where I got it from was the debugger.

You need to replace the line of code you marked in bold in your first message with the one I provided.

ok but what i pulled out was in Debug mode so where would i put it back in?

In the debugger you should see the object name and the exact trigger that contains the code.

I get to the codeunit i believe it is and i apparently dont have access to change it. Am i in the wrong spot?

Are you using the right license (with Application Builder granule) when trying to modify the codeunit?

I am not sure where would I find that information out and how would I correct it if not?