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

Community site session details

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

Creating queries dynamically

(0) ShareShare
ReportReport
Posted on by 10

Hi all,

is it possible to create queries dynamically? Let's say from codeunits or similar.

I would like to expose query objects as API's based on customer preferences, without uploading new extensions.

Thanks!

I have the same question (0)
  • Suggested answer
    Marco Mels Profile Picture
    on at
    RE: Creating queries dynamically

    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.

    Thanks.

  • sersenia Profile Picture
    10 on at
    RE: Creating queries dynamically

    Hi Josh,

    thank you for this info, but I need solution without customer intervention.

    I'm developing control add-in that will be embedded inside BC. This control add-in will have business logic and based on current state I need to dynamically create queries to expose the data.

    One solution would be to dynamically create AL files and compile extension outside of BC and install it to expose API's. This whole procedure can be automated, but it's not acceptable in my case because I would need external server to do this.

    The other solution is to use RecordRef.Open(tableId), read content and return it to caller. But I don't wan't to do this, because I suppose concating large strings can be big issue. As well as this isn't elegant solution

    If I could expose api's programatically would be perfect solution for my case

  • Suggested answer
    JAngle Profile Picture
    113 on at
    RE: Creating queries dynamically

    There is a wizard which let’s you configure a page/query objects and set specific fields and filters:

    docs.microsoft.com/.../1-web-services

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…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,899 Super User 2025 Season 2

#2
Sumit Singh Profile Picture

Sumit Singh 2,444

#3
Jeffrey Bulanadi Profile Picture

Jeffrey Bulanadi 2,304

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans