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

Notifications

Announcements

Community site session details

Community site session details

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

Generate GUIDs for API use

(0) ShareShare
ReportReport
Posted on by 5

Hi,

I'm trying to create new customer via BC api v2, but examples available in documentation contains id and name values which I would like to be set automatically - generated GUID and next available customer number like C00020. Acording to documentation I need to POST JSON body like this:

{
    "id": "f2a5738a-44e3-ea11-bb43-000d3a2feca1",
    "number": "10000",
    "displayName": "Adatum Corporation",
    "type": "Company",
    "addressLine1": "192 Market Square",
    "addressLine2": "",
    "city": "Atlanta",
    "state": "GA",
    "country": "US",
    "postalCode": "31772",
    "phoneNumber": "",
    "email": "robert.townes@contoso.com",
    "website": "",
    "taxLiable": true,
    "taxAreaId": "90196a90-44e3-ea11-bb43-000d3a2feca1",
    "taxAreaDisplayName": "ATLANTA, GA",
    "taxRegistrationNumber": "",
    "currencyId": "00000000-0000-0000-0000-000000000000",
    "currencyCode": "USD",
    "paymentTermsId": "04a5738a-44e3-ea11-bb43-000d3a2feca1",
    "shipmentMethodId": "00000000-0000-0000-0000-000000000000",
    "paymentMethodId": "3b196a90-44e3-ea11-bb43-000d3a2feca1",
    "blocked": " ",
    "lastModifiedDateTime": "2020-08-21T07:38:44.293Z"
}

How to get id for new customer and 'next available' customer number?

When I omit id and number in request body I get "Invalid Request Body" error :/

I have the same question (0)
  • Suggested answer
    JAngle Profile Picture
    135 on at

    Within BC search for api setup and verify the template assigned to table 18 has a no. series assigned to it

    59B64E5E_2D00_DB02_2D00_4940_2D00_8670_2D00_62C33587AFCE.jpeg
    then omit the fields from the POST action.

  • Suggested answer
    zielus Profile Picture
    5 on at

    Thank you Josh for the tip! I couldn't find an option to choose No. Series for Configuration template but figured out that the problem was in json request body itself.

    I think example request body available here:

    docs.microsoft.com/.../dynamics_customer_create

    is not correct. I had to remove from request body "taxAreaDisplayName" and "lastModifiedDateTime" fields and I finally get "201 Created" response :) Of course I omitted "id" and "name" and that fields was generated automatically.

  • Verified answer
    YUN ZHU Profile Picture
    96,039 Super User 2025 Season 2 on at

    Hi, If you set the default No. Series for the Customer in BC, as long as you omit these two fields, the system will automatically generate it.

    pastedimage1657499214816v2.png

    For example,

    [View:/cfs-file/__key/communityserver-discussions-components-files/758/Test0711.mp4:1181:885]

    Thanks.

    ZHU

  • zielus Profile Picture
    5 on at

    Thank you ZHU! I modified my json request body and now works like a charm :)

  • Suggested answer
    jamescarrey Profile Picture
    5 on at

    Thanks, Josh, for the helpful tip! Although I couldn't find an explicit option to select "No. Series"or UUID/Guid Generator for the Configuration template, I discovered that the issue actually resided in the JSON request body.

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

News and Announcements

Season of Giving Solutions is Here!

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 1,798

#2
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 812 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 717 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans