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 :
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,941 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

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 > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,010

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,270 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,085 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans