Skip to main content
Business Central forum

Generate GUIDs for API use

editSubscribe (0) ShareShare
Posted on by 5


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": "",
    "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 :/

  • Suggested answer
    jamescarrey Profile Picture
    jamescarrey 5 on at
    RE: Generate GUIDs for API use

    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.

  • zielus Profile Picture
    zielus 5 on at
    RE: Generate GUIDs for API use

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

  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 59,978 Super User on at
    RE: Generate GUIDs for API use

    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.


    For example,




  • Suggested answer
    zielus Profile Picture
    zielus 5 on at
    RE: Generate GUIDs for API use

    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:

    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.

  • Suggested answer
    JAngle Profile Picture
    JAngle 33,131 on at
    RE: Generate GUIDs for API use

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

    then omit the fields from the POST action.

Helpful resources

Quick Links

What Motivates a Super User?

We know many of you visit the Dynamics 365 Community and Power Platform…

Demystifying Copilot with Georg Glantschnig…

Industry experts answer burning questions directly from our amazing Community…

Setting Up Knowledge Sources for Copilot…

Look at how configuring a comprehensive knowledge base is crucial…


Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,068 Super User

Martin Dráb Profile Picture

Martin Dráb 222,591 Super User

nmaenpaa Profile Picture

nmaenpaa 101,138

Product updates

Dynamics 365 release plans