Skip to main content

Notifications

Community site session details

Community site session details

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

Expose Closing Dates in Business Central API

(0) ShareShare
ReportReport
Posted on by 5

Hi,

I am needing expert advice on how to write an extension such that I can expose closing dates of Business Central. From what I understand dates in API (APIv2 and ODATA) do not contain any information about closing dates as the type is Edm.Date. After lots of hours looking for a solution, using the source looked promising (CLSINCOME), but not all entries are of this source, with some being general journals. Hence I need to get information in the API about a date being a closing date. This is for historical data as well as current so a solution to calculate and store a new field in a table extension may not work unless I can update all historical data.

So my questions:

Can a query extension do a calculation such as set a entry flag, date := ClosingDate(date)? From what I can see this is a no as queries all flow through to T_SQL.

If a calculated field is displayed on a page, but not stored, can this be sent via an API call to the page?

If I need to store a closing date flag in my data, can run a procedure that would update historical data without breaking any data?

Thank you brains trust.

Regards

Darryn

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,021 Moderator on at
    RE: Expose Closing Dates in Business Central API

    Hi Darryn

    You can not do a sql query against BC cloud.

    But a query can be a good option.

    And yes, flowfields are supported in the query objects.

    Here is some more info around it:

    docs.microsoft.com/.../optimize-sql-query-objects-and-performance

    Hope this helps you.

  • Darryn Profile Picture
    5 on at
    RE: Expose Closing Dates in Business Central API

    Hi Inge. This is Business Central cloud. Can I still do SQL queries? Also, what type would I give the Flow Field. I am using an approach which Josh suggested for Page, but would also explore a Query approach if possible. Can Flowfields be used in queires?

  • Darryn Profile Picture
    5 on at
    RE: Expose Closing Dates in Business Central API

    Josh, Thank you for sharing your use and solution. It helped me to be able to understand how to provide a solution. In the end I have done a simple Format of the date including <Closing> and will further process after consuming through the API.

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,021 Moderator on at
    RE: Expose Closing Dates in Business Central API

    In the SQL database the posting date is a date/time field.

    So the difference for a normal date and the closing date is the time you see in that field.

    Normal dates have one time, closing date has another timestamp for the same date.

    So you can query them from the SQL server.

    And yes you can build a API that returns the value of a flowfield. You just need to make sure you do a clacfields on them in the API code.

  • Suggested answer
    JAngle Profile Picture
    83 on at
    RE: Expose Closing Dates in Business Central API

    A very different topic but it should show that having a procedure associated to a field in an api page can return simple or complex types: joshanglesea.wordpress.com/.../

    Prior-Year entry is another field that could help with filtering

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,125 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,871 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans