Skip to main content

Notifications

Community site session details

Community site session details

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

Dynamically exposing extension fields to webservice and based on that the correct webservice decision

(1) ShareShare
ReportReport
Posted on by 5

We are about to develop an AL API app for BC365. This API app will contain webservices to read data from BC tables. Like master data like from table Item.

For us is right now not clear which technology fits best and what are the advantages and disadvantages.

Should we decide to go with:

- oData

- Soap

- Codeunits

- XMLPorts

- oData with exposed pages

Our requirements:

- read extension fields dynamically (see below) https://community.dynamics.com/nav/b/navigateintosuccess/posts/using-complex-types-with-custom-apis

- read extension tables dynamically (see below)

- possible to use nextLink https://docs.microsoft.com/en-us/powerapps/developer/data-platform/webapi/query-data-web-api#limits-on-number-of-tables-returned

- possibilty to reduce the properties of types to the properties what we need. For example for table Item not all columns are needed and to reduce the amount of data being queried it would be good to to able to define for example which of the Item standard columns are needed. 

- flexible to join other tables and return in the webservice

- fast webservice to read mass data

- compatibility to BC14 and BC17 (if possible). I mean in BC17 the structure of the database tables has be changed where extension fields are Because in BC17 extension fields are in separate tables.

Further explanation for: read extension fields dynamically

In the following you can see an OData from our application (it's the application which loads the data from BC). Our application can handle extension fields (we call it extension values) dynamically. That means during runtime of the application the application checks for each type if there are any extension fields by customization defined and exposes it in the metadata typesafe and also in the webservice to get the data.

Our application is sold to different of our customers where each customer can have its own customization and coming with that extension fields. The same is for the AL app which we want to develop. Our customers can have different extension fields for BC and I don't want to modify my AL app for each new extension field being added.

In our application extension fields are automatically being detected and added to each entity.

pastedimage1621494969550v2.png

Every type in our application is in the webervice of type EntityType and has ExtensionValues property

pastedimage1621495033715v3.png

User_ExtensionValues is ComplexType containing the extensionvalues.

pastedimage1621495096670v4.png

Read extension tables dynamically

We need also have the possibility the read entirely new tables which are added as extension. No code in the AL app should be needed to be changed. The webservice caller knows what table and fields are required and the AL webservice should then dynamically build the query.

I am very interested on your answers. Thank you in advance

  • Suggested answer
    Andy Sather Profile Picture
    on at
    RE: Dynamically exposing extension fields to webservice and based on that the correct webservice decision

    Hello  - We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist.  If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    dynamicsuser.net/.../developers

    I will open this up to the community in case they have something to add.

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 815

#2
YUN ZHU Profile Picture

YUN ZHU 773 Super User 2025 Season 1

#3
Mansi Soni Profile Picture

Mansi Soni 569

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans