web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Odata Sales Order Creation - Wrong Zip Code Picked from the Zip Codes table

(0) ShareShare
ReportReport
Posted on by 51

Hi All,

I am creating sales orders in NAV through Odata REST web services, I set "ship_to" details in the JSON of the POST request i.e., City, State, Zip Code and Country. NAV tends to pick up the details which appear 1st on the Zip Codes table based on Zip Code and City. Since same zip code has different city names, I'm facing issue with address mis-match on the sales order and tax calculation.

For instance the order details I set in JSON are as follows:
{

  "Ship_to_City": "Sandstone",
  "Ship_to_County": "MN",
  "Ship_to_Post_Code": "55072",
  "Ship_to_Country_Region_Code": "US"

}

Details about zip code 55072 (from google): 55072, Postal code in Minnesota, Cities: Sandstone, MN, Markville, MN, Cloverton, MN, Duxbury, MN, Kingsdale, MN, Groningen, MN
So same zip code has different city names.

Zip Code Table in NAV: has 2 entries for 55072

Code     City    Country

55072    Markville    US      ----- NAV always picks this details

55072    Sandstone   US    ----- when I try to post with this line details

After creating the sales order, NAV returns the following:
{

  "Ship_to_City": "Markville",
  "Ship_to_County": "MN",
  "Ship_to_Post_Code": "55072",
  "Ship_to_Country_Region_Code": "US"

}

Due to this, the customer order details and what's in NAV do not match up which in-turn causes tax miscalculation in NAV.

From my little understanding of NAV:
1. While creating a new entry in zip codes table, the combination of Zip code and City name is treated as primary/unique key.

2. When I post a sales order, NAV gets all the entries for a zip code and sorts it based on city name to pick the first one from the list.

Please help me resolve the issue.

Thanks in Advance!

Kishore.

I have the same question (0)
  • Verified answer
    Suresh Kulla Profile Picture
    50,278 Super User 2026 Season 1 on at

    Try setting the city and county values after you set the post code

  • Kishore22 Profile Picture
    51 on at

    Thanks Suresh Kulla, your response definitely helped me.

    My approach:

    1. I just POST the sales order as I used to do it previously.

    2. I compare the Code, City, County and Country in both POST body JSON and NAV response JSON.

    3. If they are different, I do a PUT/PATCH request with correct details.

    And above approach works fine.

    Thanks again,

    Kishore.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,024 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,145 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 705 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans