web
You’re offline. This is a read only version of the page.
close
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

I have the same question (0)
  • Verified answer
    Suresh Kulla Profile Picture
    50,245 Super User 2025 Season 2 on at

    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?

  • MWillis1 Profile Picture
    7 on at

    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!

  • Sivaprakash2305 Profile Picture
    15 on at

    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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
HoangNam Profile Picture

HoangNam 7

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans