Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Can create SalesLines for Sales Quote or Credit Memos

Posted on by Microsoft Employee

I am developing an integration with MS Dynamics NAV by using OData web services.
Everything works great except when I try to add SalesLines for SalesQuote or SalesCreditMemo. When I post the following JSON I always get the error "Document No. must have a value in Sales Line: Document Type=Credit Memo, Document No.=, Line No.=0. It cannot be zero or empty." .
I use the exact same procedure/steps for SalesInvoice and SalesOrders and the lines are added correctly.
I tried everything but no luck....Am i missing something?

Post request to: "192.168.41.124/.../Company('CRONUS Canada, Inc.')/SalesCreditMemoSalesLines?format=json"
With json body:
{
  "Document_Type": "Credit Memo",
  "Document_No": "1016",
  "Type": "Item",
  "Description": "Product with characteristics",
  "No": "70067"
}

*This post is locked for comments

  • itschazzux Profile Picture
    itschazzux 5 on at
    RE: Can create SalesLines for Sales Quote or Credit Memos

    I had the same problem and was able to resolve it by adding the fields "Document No." and "Line No." to the Sales Cr. Memo Subform (Form id 96) in the Nav Development environment.

    After doing this and compiling, I was able to post SalesCreditMemoLines

  • sweo7 Profile Picture
    sweo7 5 on at
    RE: Can create SalesLines for Sales Quote or Credit Memos

    Hello,

    i am struggeling with this exact same stuff.

    Did you find a solution to this?

    Thank you very much!

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Can create SalesLines for Sales Quote or Credit Memos

    I am using OData webservices for adding the entities.

    First I send a POST request to create a new credit memo

    192.168.41.124/.../Company('CRONUS Canada, Inc.')/SalesCreditMemo?format=json

    with body:

    {
    
     "Document_Type": "Credit Memo",
    
     "Sell_to_Customer_Name": "Thomas Zisopoulos",
    
     "Sell_to_Address": "address",
    
     "Sell_to_Address_2": "address2",
    
     "Sell_to_Post_Code": "5555",
    
     "Sell_to_City": "Somewhere",
    
     "Document_Date": "2019-01-23T00:00:00+02:00",
    
     "Due_Date": "2018-02-06T00:00:00+02:00",
    
     "Currency_Code": "EUR",
    
     "Bill_to_Name": "Thomas Zisopoulos",
    
     "Bill_to_Address": "address",
    
     "Bill_to_Address_2": "address2",
    
     "Bill_to_Post_Code": "5555",
    
     "Bill_to_City": "Somewhere"
    
    }

    and once I get OK response (meaning that credit memo is created), I proceed and I send another POST request in order to add a line to this credit memo

    192.168.41.124/.../Company('CRONUS Canada, Inc.')/SalesCreditMemoSalesLines?format=json

    with body:

    {
    
     "Document_Type": "Credit Memo",
    
     "Document_No": "1041",
    
     "Type": "Item",
    
     "Description": "Product with characteristics",
    
     "No": "70069",
    
     "Quantity": 18.0
    
    }


    The same procedure works great for SalesInvoices and SalesOrders but fails for SalesQuotes and SalesCreditMemo.

    I  can view the CreditMemo on the Navision but of course there are no Lines assigned to it (due to the error I get).

    any ideas?

  • npanchal Profile Picture
    npanchal on at
    RE: Can create SalesLines for Sales Quote or Credit Memos

    For Creating Credit Memo, did you created Header?

    And for creating Creditmemo Line, you basically need Document Type, Document No. and Line No.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Can create SalesLines for Sales Quote or Credit Memos

    Hi Suresh,
    I went to the setup page you mentioned and I do not see any difference between credit memos , order, invoices. They all have the appropriate number series.
    I do not set any order manually for the Credit Memo. The only values I am setting are the ones I mention in my first post.

    I have attached a print screen of the setup as well in case you notice something.

    setup.png

  • Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Can create SalesLines for Sales Quote or Credit Memos

    Thomas,

    Check the No. series setup on sales & Receivables setup for credit memos' vs orders vs Invoices. Are you manually inserting the order No. if so it should setup has Manual and make sure the No. series setup for Credit Memo is setup.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Can create SalesLines for Sales Quote or Credit Memos

    Unfortunately it does not work either.

  • npanchal Profile Picture
    npanchal on at
    RE: Can create SalesLines for Sales Quote or Credit Memos

    Try to pass Customer No. in Line this may solve your problem.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Can create SalesLines for Sales Quote or Credit Memos

    Hi Nileshkumar,

    Although I do not think that this is the issue since SalesInvoiceSalesLines accept my request without Line No (i think all saleslines are the same entities), I tried it with some dummy data and it doesn't work.

    If I send with POST Document Type = "Credit Memo" , Document No."the number of memo" and Line No="10000" I get bad request response with the error " Entity do not support insert".

    I have tried also to use PUT method but I get the response of "Invalid concurrency token" which is a valid response since PUT is only for updating entities.

    What I do not understand is why lines for SalesInvoices and SalesOrders have different handling than lines for SalesCreditMemo and SalesQuote since they are the same entity (as far as I understand from DB and object schemas).

    Is there any other way to insert SalesLines to a CreditMemo or a SalesQuote?

    Thanks

  • npanchal Profile Picture
    npanchal on at
    RE: Can create SalesLines for Sales Quote or Credit Memos

    You need to pass Line No. as it is in Primary Key.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans