Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Error Message: The Sales Line does not exist

(0) ShareShare
ReportReport
Posted on by 1,305

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

  • Verified answer
    Dan Eckhoff Profile Picture
    1,305 on at
    RE: Error Message: The Sales Line does not exist

    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.

  • Dan Eckhoff Profile Picture
    1,305 on at
    RE: Error Message: The Sales Line does not exist

    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

  • Suggested answer
    keoma Profile Picture
    32,727 on at
    RE: Error Message: The Sales Line does not exist

    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 (?)?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics NAV (Archived)

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2

#1
mmv Profile Picture

mmv 2

#1
Amol Salvi Profile Picture

Amol Salvi 2

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans