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...
Suggested Answer

Trying to create a SO from C# using OData Service

(0) ShareShare
ReportReport
Posted on by 20

i am trying to create SO in business central using OData.

here is my code

NAV con = BCConnection.connect();
            SalesOrderHeader aa = new SalesOrderHeader
            {
                Number="123",
                CustomerNumber = "C1002",
                BillToCustomerNumber = "C1002"
        };
            con.AddObject("salesOrderHeaders", aa);
            con.SaveChanges();

with this code its giving error 

Name Value Type
InnerException "{\"error\":{\"code\":\"Application_DialogException\",\"message\":\"You may not enter numbers manually. If you want to enter numbers manually, please activate Manual Nos. in No. Series S-ORD. CorrelationId: 1756ebb5-dee8-42a5-a033-9a41cc263130.\"}}" System.Exception {Microsoft.OData.Client.DataServiceClientException}

but if i try without Number 

its saying Number cannot be null

I have the same question (0)
  • Suggested answer
    Andrey Baludin Profile Picture
    3,943 on at

    Hi! This is BC "No Series" error, not C#.

    Open Business Central, then open No. Series page, select number series which you use for Sales Orders (by default it's S-ORD) and set a mark on "Manual Nos." field to let you create number manually.

    If you want to generate Sales orders numbers automatically just remove Number="123" parameter from your request.

  • noozan Profile Picture
    20 on at

    thank you for the reply and its working fine when I enable manual number.
    still if I submit without number, its giving the following error

    InnerException "{\"error\":{\"code\":\"BadRequest\",\"message\":\"A null value was found for the property named 'number', which has the expected type 'Edm.String[Nullable=False]'. The expected type 'Edm.String[Nullable=False]' does not allow null values. CorrelationId: e12b7021-4750-4fec-bc0d-ea9056f9cd74.\"}}" System.Exception {Microsoft.OData.Client.DataServiceClientException}

    is there any way i can save without the number, as i want it to generate automatically.

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 April 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,059 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 994 Super User 2026 Season 1

#3
Teagen Boll Profile Picture

Teagen Boll 664 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans