Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

oData insert into Sales Discount Line using Sales Code fails

(0) ShareShare
ReportReport
Posted on by 7

I’m having some trouble inserting lines into the Sales Line Discount table using Nav’s oData web API. I’m inserting a line that includes the Sales Code column, but Navision gives back an error message saying "Sales Code must be blank". However, I'm also setting Sales Type to Customer, which in turn requires that Sales Code must not be blank. In fact, if I repeat the same insert but leave Sales Code blank, it fails and says Sales Code must NOT be blank!

Here are the specifics of the insert:

Type = Item
Unit Of Measure Code = EA
Sales Type = Customer
Code = TEST1234
Minimum Quantity = 1
Discount Price = 0.01
Starting Date = 2019-08-01T:00:00:00
Sales Code = 1111

It seems like Nav and/or oData is validating the Sales Code column before checking Sales Type - which doesn't make sense because the value of Sales Code is dependent on the value of Sales Type.. Any thoughts on what I could be doing wrong?

*This post is locked for comments

  • Sivaprakash2305 Profile Picture
    Sivaprakash2305 15 on at
    RE: oData insert into Sales Discount Line using Sales Code fails

    Can u send me the code of how to insert data into sales discount line. Am new to this dynamics could not able to figure out the way. Can u help me on this

    Thanks in advance

  • MWillis1 Profile Picture
    MWillis1 7 on at
    RE: oData insert into Sales Discount Line using Sales Code fails

    That fixed it - I had to move the Sales Type column above Sales Code in the Page I had published (it was a custom page). Thanks Suresh!

  • Verified answer
    Suresh Kulla Profile Picture
    Suresh Kulla 44,592 on at
    RE: oData insert into Sales Discount Line using Sales Code fails

    Which page did you publish, try to realign the sequence of fields on that page and it to the front and i.e. before the Sales Type field?

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 Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,489 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans