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...
Unanswered

API Setup template don`t work if set "Base Unit of Measure" in post API query

(0) ShareShare
ReportReport
Posted on by

Hi there!

Try migrate BC from 17 to 18, and when test standard API Items V2.0 (default Microsoft API)  found an stange behavior of templates.

If do post with baseUnitOfMeasureCode templates don`t work.

Test querry like:

{
"displayName": "testtest",
"baseUnitOfMeasureCode": "BOX"
}

If do querry without baseUnitOfMeasureCode API Setup templates works fine.

Try test with own database and  also try demo Cronos Database with default templates and API - same resault.

In BC v17 all works fine, but v18 don`t (try v18.3 and v18.6).

Why when post baseUnitOfMeasureCode via API Setup tamplets stop work?

How to fix that?

  • Lars Lohndorf-Larsen Profile Picture
    Microsoft Employee on at

    Hello,

    Thank you for logging this, I see what you mean. I foud out that with this, the template is not applied:

    POST MyPC:18048/.../items

    {
    "displayName": "testtest",
    "baseUnitOfMeasureCode": "BOX"
    }
    But if you replace Code with Id, then it does work:
    {
    "displayName": "testtest",
    "baseUnitOfMeasureId": "1e75fe31-9a1d-ec11-bb75-000d3a299bbf"
    }
    Would that work for you?
  • AlexanderLebedev Profile Picture
    on at

    Hello,

    Lars, thanks for you answer.

    It`s true, if do post of "baseUnitOfMeasureId" instead of "baseUnitOfMeasureCode" API Setup templates are works fine.

    But we use API for integration with another accounting system and use CODE of units of measure for exchange between BC and this system.

    Unfortunately there are no ability to use the ID of BC items in this system.

  • Lars Lohndorf-Larsen Profile Picture
    Microsoft Employee on at

    Hi Alexander,

    I did expect that this would be your answer :-). I will investigate a bit further and see if I can find out some more details.

  • AlexanderLebedev Profile Picture
    on at

    Lars, thanks for your response.

    I try to investigate this problem by compare v17 vs v18 and found that in table 27 "Item" under OnValidate trigger of field "Base Unit of Measure" in v18 was added

    v18.PNG

    As I understand code, in v18 if field comes from OData or API it insert a record, and API Setup don`t execute. 

    Also changes comes to codeunit 5465 "Graph Mgt - General Tools", as I undunderstand this CU do the ApiSetup...

    I can`t understand why in v18 do that changes and when must call ApiSetup feature.

    Maybe you can help me at least understand how to work this ApiSetup functionality? When and from where this part calling?

  • Lars Lohndorf-Larsen Profile Picture
    Microsoft Employee on at

    Hi Alexander,

    Thank you for researching this, I have fed it back to development. Meanwhile it is also reported here:

    github.com/.../15135

    Will try to keep you updated if I hear news.

  • AlexanderLebedev Profile Picture
    on at

    Hi Lars,

    Thanks for the answer.

    This  my report on github.

    We will wait for an response.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 570 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 390 Super User 2026 Season 2

#3
Teagen Boll Profile Picture

Teagen Boll 220 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans