[API] Add API - Codeunits app (sample API codeunits) - #10289
Draft
Onat Buyukakkus (onbuyuka) wants to merge 3 commits into
Draft
[API] Add API - Codeunits app (sample API codeunits)#10289Onat Buyukakkus (onbuyuka) wants to merge 3 commits into
Onat Buyukakkus (onbuyuka) wants to merge 3 commits into
Conversation
New W1 app (id range 6007-6014, target Cloud) exposing selected non-data-bound Business Central operations as API codeunits under the microsoft/codeunits route. Includes five wrapper codeunits - No. Series, Approvals, Environment, Identity and Date Time - plus the objects permission set. The API subtype/publisher attributes depend on platform AB#641822 and will be added when it ships. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: eb90ebfd-967b-4ba4-98ec-57b054806669
Per review, drop API tools that add little value or cannot be used: - Date Time API: parameterless CreateTimestampSeconds() and CreateTimestampMilliseconds() (kept the DateTime overloads). - Approvals API: Approve, Reject and Cancel, which require a workflowStepInstanceId this toolset provides no way to discover (kept GetDirectApprover). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1b34da29-3e61-4831-9999-c4e3cce5f128
Onat Buyukakkus (onbuyuka)
temporarily deployed
to
triage
August 17, 2026 09:12 — with
GitHub Actions
Inactive
Add the new "API - Codeunits" app (src/Apps/W1/APICodeunits) to the build registration so it is compiled, translated and shipped like other W1 apps: - build/projects.json: new project entry (W1 path, hasTranslations, All countries, base ruleset), mirroring API Reports - Finance. - build/groups.json: group membership (AllExtensions, Financials, FinancialsExtensions, OnPrem, OnPremExtensions). - build/projects/Apps <CC>/.AL-Go/settings.json (all 23 country projects): add the app folder to appFolders. No test entry as the app has no test project yet. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1b34da29-3e61-4831-9999-c4e3cce5f128
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Adds a new API - Codeunits app (
src/Apps/W1/APICodeunits) that exposes selected standard Business Central operations as API codeunits — non-data-bound unbound actions published under themicrosoft/codeunitsroute — for programmatic and agent (MCP) access.This was split out of PR #10008 ([MCP] Add codeunit APIs as MCP tools) so the sample/utility app can be reviewed and shipped independently of the MCP configuration changes. The app provides the concrete API codeunits that the MCP work surfaces as tools.
The app wraps existing platform/base functionality (no new business logic); each codeunit is a thin facade:
GetDirectApprover.IsProduction,IsSandbox,IsSaaS,GetEnvironmentName,GetAadTenantId, license/trial state, start/end dates,VersionInstalled, …).IsPlanAssignedToUser,IsUserTenantAdmin,ArePermissionsCustomized,IsFirstLogin, penultimate login, …).GetNextNo,PeekNextNo,GetLastNoUsed, manual/automatic/date-order checks,SimulateGetNextNo.Object ID range 6007–6014, target Cloud.
Following earlier review, a few low-value / hard-to-use actions were removed before this PR:
Approve/Reject/Cancelon Approvals API (require an internal workflow step instance id with no discovery path) and the parameterlessCreateTimestampSeconds()/CreateTimestampMilliseconds()overloads on Date Time API (kept theDateTime-argument versions).Linked work
Fixes AB#647046
Related ADO work item: AB#641822 (platform API-codeunit subtype). Companion PR: #10008.
How I validated this
What I tested and the outcome
Draft — local build/run validation still pending. The app was split cleanly from PR #10008 (the app files are unchanged from that branch aside from the method removals noted above). No automated tests are included yet; test coverage is a planned follow-up.
Risk & compatibility
main.SubType(AB#641822), these codeunits are identified by theMicrosoft.API.Codeunitsnamespace and routed asmicrosoft/codeunits/beta. To be revisited when the subtype is available.