I'm getting an error in NAV 2015 on a custom import codeunit I wrote. I've done this a hundred times, but am getting a message I can't figure out. I keep getting that the sales line does not exist... funny this is that the debugger shows that the line is active and the code itself would suggest that we're on it.
code snippet follows:
SalesLine.RESET;
SalesLine.SETRANGE("Document Type", SalesHeader."Document Type");
SalesLine.SETRANGE("Document No.", SalesHeader."No.");
SalesLine.SETRANGE("Line No.", SalesLineImport."Line No.");
IF SalesLine.FINDFIRST THEN BEGIN
SalesLine.SetHideValidationDialog(TRUE);
SalesLine.VALIDATE("Location Code", '04');
SalesLine.VALIDATE("No.", Item."No.");
SalesLine.VALIDATE(Description, SalesLineImport.Description);
SalesLine.VALIDATE("Requested Delivery Date", SalesLineImport."Requested Shipment Date");
SalesLine.VALIDATE("Unit of Measure", SalesLineImport."Unit of Measure");
SalesLine.VALIDATE(Quantity, SalesLineImport.Quantity);
SalesLine.MODIFY;
END ELSE BEGIN
*This post is locked for comments
False Alarm? I restarted the NAV service and it works as expected now. I had run the test import several times with various errors in scripting, perhaps there was some junk in a buffer.
Jonathon,
It DOESN'T exist - I had already checked. So how does it get into that IF stub given the FINDFIRST?? - I think I should be in the ELSE which comes below my snippet.
Dan
hi,
did you check if a sales line with the given line no (from the sales line import rec) does exist in that sales order (?)?
Sohail Ahmed
2
mmv
2
Amol Salvi
2