Compare commits

..

220 commits

Author SHA1 Message Date
Jeremy Vyska
dbbc3d3cdc
Merge pull request #286 from microsoft/add-kine-knowledge-gap-article
Add article: AI for BC Development - The Knowledge Gap That Ships to Production
2026-04-01 11:54:55 +02:00
Jeremy Vyska
3e884878ab Add Kine article: AI Knowledge Gap That Ships to Production to vibe coding resources
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-01 09:19:07 +02:00
Jeremy Vyska
76159eb8cc
Merge pull request #283 from microsoft/agentic-assistance-hub
Orphaned files meant for the original PR
2026-01-20 14:24:42 +01:00
Jeremy Vyska
6f72c21a60 Orphaned files meant for the original PR 2026-01-20 14:23:48 +01:00
Jeremy Vyska
36c4ec1c0e
Merge pull request #275 from microsoft/issues/250
Fix #250: Clarify case sensitivity of APIPublisher and APIGroup
2025-12-16 12:24:39 +01:00
Henrik Helgesen
ed0868d8c1
Merge pull request #273 from microsoft/issues/150
Fix #150: Replace unavailable video with note
2025-12-03 12:44:37 -08:00
Henrik Helgesen
345e0f2a64
Merge pull request #274 from microsoft/issues/270
Fix #270: Add CAL Coding Guidelines PDF and fix broken link
2025-12-03 12:43:39 -08:00
Henrik Helgesen
b8d7ceccfc
Merge pull request #282 from javiarmesto/ai-native-dev-guideline
New Tool - AI Native AL Development toolkit
2025-12-03 12:37:25 -08:00
Javier Armesto Gonzalez
aa970ed0a6
Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-28 12:00:55 +01:00
Javier Armesto Gonzalez
0042e10d5f
Add files via upload 2025-11-28 11:00:53 +01:00
Jeremy Vyska
d2cdf97e0c
Merge pull request #279 from microsoft/jeremy-siteops
Front page updates & fixes
2025-11-10 12:48:24 +01:00
Jeremy Vyska
3a262c4d33 Refresh of front page content 2025-11-10 12:47:46 +01:00
Jeremy Vyska
9ea56d5843 Fixing broken front page link 2025-11-10 12:39:14 +01:00
Jeremy Vyska
e508cb64fb
Merge pull request #278 from microsoft/main
Updating siteops branch for small fixes
2025-11-10 12:37:43 +01:00
Henrik Helgesen
afc35a8c51
Merge pull request #265 from igor-ctrl/patch-1
Update index.md
2025-10-23 09:50:39 -07:00
Jeremy Vyska
aba9b11f07 Fix #250: Clarify case sensitivity of APIPublisher and APIGroup for subscriptions 2025-10-18 13:45:00 +02:00
Jeremy Vyska
77b968ae1f Fix #270: Add CAL Coding Guidelines PDF and update broken link 2025-10-18 13:42:14 +02:00
Jeremy Vyska
8afc5570db Fix #150: Replace unavailable video with note about missing content 2025-10-18 13:35:27 +02:00
Jeremy Vyska
2c230e308c
Merge pull request #272 from microsoft/agentic-assistance-hub
Agentic assistance hub
2025-10-17 15:19:07 +02:00
Jeremy Vyska
9055fcbbd4 Adding vibe coding to the index 2025-10-17 15:16:55 +02:00
Jeremy Vyska
d0ebcffb21 Merge remote changes - accept incoming al-upgrade.md file 2025-10-17 14:38:44 +02:00
Jeremy Vyska
e079f2b10f
Merge pull request #271 from microsoft/main
Pulling main back into Agentic
2025-10-17 14:34:31 +02:00
Jeremy Vyska
86ee402b1b Reorganizing Agentic/Vibe Section 2025-10-17 14:30:58 +02:00
Jeremy Vyska
86d86c326b Fixing broken internal links 2025-10-17 14:27:13 +02:00
Jeremy Vyska
b0ae28ffa1
Merge pull request #268 from microsoft/agentic-assistance-hub
Agentic assistance hub

Reviewed by several peers, better to get in place to improve.
2025-10-17 12:22:33 +02:00
Jeremy Vyska
907a8f3415 Clean up Articles page: remove placeholders, add CTA and quality checklist 2025-10-17 12:20:43 +02:00
Jeremy Vyska
784ef6d58d Add Waldo BC Telemetry Buddy page (summary, links) 2025-10-17 12:20:41 +02:00
Jeremy Vyska
0f61791734 Add NAB AL Tools MCP page (summary, features, links) 2025-10-17 12:20:39 +02:00
Jeremy Vyska
8a583c8edc Curate videos.md: add 4 starter videos, contributor CTA, and quality criteria 2025-10-17 12:18:50 +02:00
Jeremy Vyska
103ce14426 Add NAB AL Tools MCP server to Tools list 2025-10-17 09:22:35 +02:00
Jeremy Vyska
e6477e447d Add BC Telemetry Buddy (Waldo) to Tools list 2025-10-17 09:05:07 +02:00
Jeremy Vyska
28adab2c0a
Update creator information in documentation 2025-10-11 17:50:06 +02:00
Jeremy Vyska
b486ac7550
Merge pull request #269 from microsoft/hugo-updates
Update GitHub Actions workflow to use Hugo v0.151.0
2025-10-10 12:51:01 +02:00
Jeremy Vyska
9794f220a3 Update GitHub Actions workflow to use Hugo v0.151.0 2025-10-10 12:50:12 +02:00
Jeremy Vyska
c0ed6c9f75
Merge pull request #267 from microsoft/hugo-updates
Update Docsy to v0.12.0 for Hugo v0.151.0 compatibility
2025-10-10 12:41:15 +02:00
Jeremy Vyska
18938a0e88 Update Docsy to v0.12.0 for Hugo v0.151.0 compatibility 2025-10-10 12:40:04 +02:00
Jeremy Vyska
648d1b0bf4 Fixing menu order 2025-10-10 12:35:23 +02:00
Jeremy Vyska
4db38ba4d3 Add comprehensive agentic coding documentation
- Add 6 MCP server documentation pages (bc-code-intelligence, al-dependency, azure-devops, serena, al-objid, clockify)
- Add AI Coding Agents documentation (GitHub Copilot, Claude, Cursor)
- Add Getting Started section (what is agentic coding, setup, prompting, best practices, limitations, glossary)
- Add Getting More section (code review, documentation, telemetry examples)
- Add Community Resources placeholders (articles, videos, tools)
- Update Tools section to focus on MCP servers instead of VSCode extensions
2025-10-10 12:25:41 +02:00
Nikola Kukrika
8626051cd3
Merge pull request #266 from microsoft/features/UpgradeGuidelines
Upgrade guidelines
2025-10-09 11:18:25 +02:00
Nikola Kukrika
17f18636c7 Adding lattest instructions 2025-10-08 12:52:09 +02:00
Igor
7dd5bae8c9
Update index.md
## Update No. Series pattern for BC v24+ modern API

Microsoft deprecated `NoSeriesManagement` in BC v24+. Added modern `codeunit "No. Series"` pattern documentation with simplified API examples, comparison table, and method reference. Legacy content preserved for backward compatibility.

Real-world implementation verified in production BC extension.
2025-10-01 15:34:12 -05:00
Nikola Kukrika
4a0ab33045 Upgrade review guideliness 2025-09-16 15:44:59 +02:00
Jeremy Vyska
f82dfd03b4
Merge pull request #264 from microsoft/jeremy-siteops
Merge pull request #263 from microsoft/main - site engine updates
2025-08-11 10:16:24 +02:00
Jeremy Vyska
3254d9b7e8 Update GitHub Page deploy action 2025-08-11 10:15:56 +02:00
Jeremy Vyska
51224f6bc7
Merge pull request #263 from microsoft/main
Updating old branch to fix some actions
2025-08-11 10:15:25 +02:00
Jeremy Vyska
aa63b549fb
Merge pull request #260 from christianbraeunlich/update-upload-artifact-action
Update upload-pages-artifact to v4
2025-08-11 08:35:22 +02:00
Christian Bräunlich
0aadb75631 update upload-pages-artifact to v3 2025-08-08 23:49:08 +02:00
Arend-Jan Kauffmann
92adcb9308
Merge pull request #258 from DmitryKatson/main
Vibe Coding for AL coding rules
2025-08-08 15:31:12 +02:00
Dmitry Katson
2a805b20dc Update AL coding guidelines to use PascalCase for variable and function names
- Corrected naming conventions in the AL code style documentation to specify PascalCase instead of camelCase for variables and functions.
- Adjusted examples throughout the documentation to reflect the updated naming conventions.
- Enhanced clarity in performance guidelines by renaming procedures for better understanding.
2025-07-30 22:08:25 +08:00
Dmitry Katson
6b3f522a16 Vibe Coding for AL coding rules
- Added new rules files for Vibe Coding, including guidelines on AL code style, naming conventions, performance optimization, error handling, event-driven development, and testing.
- Updated existing links
2025-06-26 14:58:03 +07:00
Arend-Jan Kauffmann
5e76983b77
Merge pull request #249 from Busschers/ErrorHandling-ListOfReferenceText
Fixed copy-paste mistake in reference text.
2024-10-04 16:58:48 +02:00
Luuk
ec423a0428 Fixed copy-paste mistake in reference text. 2024-09-11 09:41:19 +02:00
Henrik Helgesen
917a8cb5a9
Merge pull request #239 from microsoft/dependabot/npm_and_yarn/braces-3.0.3
Bump braces from 3.0.2 to 3.0.3
2024-09-10 16:22:04 -07:00
dependabot[bot]
783975bf4c
Bump braces from 3.0.2 to 3.0.3
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-10 23:19:21 +00:00
Henrik Helgesen
fede1fd20f
Merge pull request #244 from christianbraeunlich/update-docsy-hugo-modules
Technical update is required for other PR's to be merged and published
2024-09-06 11:28:44 -07:00
Henrik Helgesen
75f3d28eeb
Merge pull request #241 from Busschers/ErrorHandling
First draft
2024-09-06 11:26:09 -07:00
Arend-Jan Kauffmann
559090d1f0
Merge pull request #237 from fvet/FVE/Removed_Semicolons
Fix formatting issues and syntax errors in code
2024-09-05 10:09:44 +02:00
Christian Bräunlich
8ba7e0dd61 remove clone step 2024-09-04 05:36:45 +00:00
Christian Bräunlich
911cf76c46 remove workflow relic 2024-09-04 05:09:15 +00:00
Christian Bräunlich
102dc94877
rearrange comment 2024-09-01 12:29:57 +02:00
Christian Bräunlich
bc536ab298 cleanup .devcontainers 2024-09-01 08:37:10 +00:00
Christian Bräunlich
1edf28aba7 fix footer_about_disabled deprecated 2024-09-01 08:33:14 +00:00
Christian Bräunlich
d4d8d0f15e update workflows 2024-09-01 08:26:36 +00:00
Christian Bräunlich
1955b65f4f update package-lock.json 2024-09-01 08:23:25 +00:00
Christian Bräunlich
6f79046b48 add node to .devcontainer features 2024-09-01 08:18:33 +00:00
Christian Bräunlich
6807e6f56e Revert "remove package.json files"
This reverts commit 6d868fb3c5.
2024-09-01 08:03:53 +00:00
Christian Bräunlich
3b4f6ed968 remove .gitmodules 2024-09-01 07:46:01 +00:00
Christian Bräunlich
6d868fb3c5 remove package.json files 2024-09-01 07:45:54 +00:00
Christian Bräunlich
70a0e69751 Removed docsy git submodule 2024-09-01 07:31:53 +00:00
Christian Bräunlich
234a95fb3f update hugo.toml theme && hugo mod graph 2024-09-01 07:30:41 +00:00
Christian Bräunlich
3df13226c3 hugo mod init github.com/microsoft/alguidelines 2024-09-01 07:30:03 +00:00
Christian Bräunlich
77c64d7670 update .devcontainers 2024-09-01 07:23:20 +00:00
Christian Bräunlich
2520893058 fix custom params on the language top level was deprecated 2024-09-01 07:21:06 +00:00
Christian Bräunlich
273de376d6 rename config.yoml to hugo.toml 2024-09-01 06:55:37 +00:00
Luuk
119b1df1c6 First draft 2024-07-10 15:59:55 +02:00
Frédéric Vercaemst
3353c5184c Fix formatting issues and syntax errors in code 2023-11-24 15:16:38 +01:00
Jeremy Vyska
8c58628b85
Merge pull request #235 from microsoft/dependabot/npm_and_yarn/postcss-8.4.31
Bump postcss from 8.4.6 to 8.4.31
2023-10-09 09:26:52 +02:00
dependabot[bot]
87ec430481
Bump postcss from 8.4.6 to 8.4.31
Bumps [postcss](https://github.com/postcss/postcss) from 8.4.6 to 8.4.31.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.4.6...8.4.31)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-08 09:06:50 +00:00
Jeremy Vyska
00e696864b
Merge pull request #220 from PeterConijn/PatternFixes
Minor fixes to pattern pages
2023-09-28 07:14:49 +02:00
Jeremy Vyska
9812eccaf2
Merge pull request #226 from Busschers/SetLoadFIelds
SetLoadFields
2023-09-28 07:14:38 +02:00
Henrik Helgesen
6659139573
Merge pull request #234 from microsoft/TheDoubleH-patch-2
Update deployment method to Official hugo method
2023-09-22 08:18:47 -07:00
Henrik Helgesen
f88022c7f4
Update deployment method to Official hugo method
Create hugo.yml
2023-09-22 08:02:41 -07:00
Henrik Helgesen
3d1770c57b
Merge pull request #228 from eivindgiske/patch-1
Fixed broken link
2023-09-22 07:36:01 -07:00
Luuk
8befe1b704 #SetLoadFields 2023-09-22 13:01:23 +02:00
Luuk
892862e068 #SetLoadFIelds 2023-09-22 12:13:18 +02:00
Luuk
6b3d740bbb #SetLoadFields 2023-08-10 10:38:28 +02:00
Eivind Giske
cc4be1c80d
Update _index.md 2023-06-22 13:16:10 +02:00
Luuk
b317951d63 SetLoadFields 2023-06-06 10:58:57 +02:00
Luuk
6f8b7b3451 SetLoadFields 2023-06-06 10:52:52 +02:00
Jeremy Vyska
9a0922e35f
Merge pull request #219 from deadmouse/patch-1
Update index.md
2023-02-22 14:43:27 +01:00
Jeremy Vyska
f5da4182cd
Merge branch 'main' into patch-1 2023-02-22 14:43:19 +01:00
waldo
78fa831aec
Merge pull request #218 from SorenKlemmensen/patch-1
Update index.md
2023-02-22 13:16:25 +01:00
Peter Conijn
6bb60cb36f Minor fixes to pattern pages 2023-02-22 10:44:30 +01:00
deadmouse
375ef7043e
Update index.md
Repair broken links
2023-02-21 17:12:09 +01:00
Soren Klemmensen
8a4eca4d58
Update index.md
Broken link.
2023-02-20 17:28:34 +01:00
Jesper Schulz-Wedde
36e4ad4245
Merge pull request #207 from TKapitan/patch-1
No reason to use Reset for local variable
2022-11-30 13:37:22 +01:00
Tomas Kapitan
9b2c6f0c65
No reason to use Reset for local variable 2022-11-27 00:58:28 +10:00
Jeremy Vyska
254654c805
Merge pull request #204 from curateideas/dev/cl/bestpracticeKeyboardshortcuts
Dev/cl/bestpractice keyboardshortcuts
2022-09-25 20:55:59 +02:00
Christian Lenz
0c0575eec9 added shortcuts taken from BCTechDays session 2022-09-23 08:44:00 +02:00
Christian Lenz
d166fca3ea
Merge pull request #1 from microsoft/main
Merge pull request #202 from curateideas/dev/cl/bestpracticeKeyboards…
2022-09-16 10:08:51 +02:00
Jesper Schulz-Wedde
254d3a9228
Merge pull request #202 from curateideas/dev/cl/bestpracticeKeyboardshortcuts 2022-09-15 14:47:48 +02:00
Christian Lenz
49fd819565 changed design of the columns 2022-09-08 00:35:50 +02:00
Christian Lenz
77fde44ae4 added section for keyboard shortcuts 2022-09-08 00:15:59 +02:00
Jesper Schulz-Wedde
f1dd5b3ef1
Merge pull request #197 from christianbraeunlich/gitattributes
[Dev Container] add .gitattributes file
2022-07-12 10:27:07 +02:00
waldo
b1a5afb320
Merge pull request #198 from nareshwar/patch-1
Update index.md
2022-07-11 10:48:44 +02:00
Naresh
ced983249c
Update index.md
Fixed the code example with missing parenthesis.
2022-07-11 09:32:11 +01:00
Jeremy Vyska
f752d97ccc
Merge pull request #195 from sirhc101/main
Best Practice 'if-not-then-exit'
2022-07-11 09:30:51 +02:00
christianbraeunlich
2dd0a8f3c9 add .gitattributes 2022-07-01 17:38:29 +00:00
Jeremy Vyska
348c14eb80
Merge pull request #183 from christianbraeunlich/148-citation
Add Citation
2022-06-29 09:45:02 +02:00
Christoph Krieg
2c4e2cc991 Update examples 2022-06-27 19:22:33 +02:00
Christoph Krieg
3661c16c80 if not then exit 2022-06-27 19:17:15 +02:00
Jeremy Vyska
8f52709dc8
Merge pull request #189 from kine/temporary_table_safeguard
Add "Best Practice" IsTemporary record safeguard
2022-06-24 14:54:51 +02:00
ksacek
10818047ea Add "Best Practice" IsTemporary record safeguard 2022-06-22 15:36:54 +02:00
waldo
3dd196bc22 Fixed indentation (#188) 2022-06-22 11:23:49 +02:00
Henrik Helgesen
189ca1bb5f
Merge pull request #174 from PatrickSchiefer/template-method-pattern
Template method pattern
2022-06-14 16:17:28 -07:00
Patrick Schiefer
b952cc5421
Apply suggestions from code review
Co-authored-by: Henrik Helgesen <henrik@helgesen.consulting>
2022-06-14 15:16:45 +02:00
Patrick Schiefer
32f0ec017f
Update content/docs/patterns/template-method-pattern/index.md
Co-authored-by: Henrik Helgesen <henrik@helgesen.consulting>
2022-06-14 15:16:03 +02:00
Christian Bräunlich
b861160a51 #148 add CITATION.cff 2022-05-16 20:51:17 +02:00
Henrik Helgesen
f6a86eb60f
Merge pull request #173 from christianbraeunlich/merge-blank-lines-best-practices
[Best Practice] Merge into one Blank Lines topic
2022-05-16 11:39:20 -07:00
Christian Bräunlich
d3e38aa74a Merge branch 'main' into merge-blank-lines-best-practices 2022-05-16 20:34:46 +02:00
Henrik Helgesen
158ebff378
Merge pull request #180 from fvet/patch-4 2022-05-06 13:30:56 -07:00
Henrik Helgesen
939cfcdf9d
Merge pull request #182 from fvet/patch-6 2022-05-06 13:30:05 -07:00
Henrik Helgesen
50dc4506bb
Merge pull request #181 from fvet/patch-5 2022-05-06 13:29:20 -07:00
Henrik Helgesen
51ff02f7cd
Merge pull request #176 from christianbraeunlich/example-structure 2022-05-06 13:28:35 -07:00
Henrik Helgesen
a533a45ff2
Merge pull request #179 from fvet/patch-3 2022-05-06 13:28:09 -07:00
Henrik Helgesen
8c9b20f95f
Merge pull request #178 from fvet/patch-2 2022-05-06 13:27:26 -07:00
Henrik Helgesen
2bce340b7f
Merge pull request #177 from fvet/patch-1 2022-05-06 13:26:04 -07:00
Jeremy Vyska
3f02553645
Update content/docs/patterns/template-method-pattern/index.md
Co-authored-by: Henrik Helgesen <henrik@helgesen.consulting>
2022-05-06 12:04:24 +02:00
Jeremy Vyska
f5f8983e0b
Update content/docs/patterns/template-method-pattern/index.md
Co-authored-by: Henrik Helgesen <henrik@helgesen.consulting>
2022-05-06 12:04:18 +02:00
Jeremy Vyska
e9225a9ca8
Update content/docs/patterns/template-method-pattern/index.md
Co-authored-by: Henrik Helgesen <henrik@helgesen.consulting>
2022-05-06 12:04:12 +02:00
Jeremy Vyska
f4b53bdd45
Update content/docs/patterns/template-method-pattern/index.md
Co-authored-by: Henrik Helgesen <henrik@helgesen.consulting>
2022-05-06 12:04:06 +02:00
Frédéric Vercaemst
a1c53ccbdf
Added Tips section with link to VSCode extension 2022-05-06 09:13:50 +02:00
Frédéric Vercaemst
ee06e3d83a
Added Tips section with link to VS Code extension 2022-05-06 09:12:09 +02:00
Frédéric Vercaemst
56a903f358
Added Tips section with link to VS Code extension
#175
2022-05-06 09:09:41 +02:00
Frédéric Vercaemst
3cba72ce3f
Added Tips section with link to VS Code extension 2022-05-06 09:04:48 +02:00
Frédéric Vercaemst
0b32513b19
Added Tips section with link to VS Code extension
#153
2022-05-06 09:02:17 +02:00
Frédéric Vercaemst
a15b53e3f6
Added Tips section with link to VS Code extension 2022-05-06 09:00:32 +02:00
Christian Bräunlich
6162a121be added caption for each example 2022-05-05 16:16:27 +00:00
Patrick Schiefer
691c2fd48f Update Template method Pattern 2022-04-21 09:59:50 +02:00
Patrick Schiefer
100dffbe84 template method pattern 2022-04-21 09:44:53 +02:00
Christian Bräunlich
afc1d64ad6 updated blank lines 2022-04-15 12:59:51 +00:00
Jesper Schulz-Wedde
5652ea8c5d
Merge pull request #145 from PatrickSchiefer/commandqueue3
added command queue
2022-04-06 21:18:12 +02:00
Jesper Schulz-Wedde
32ec19fcde
Merge pull request #154 from christianbraeunlich/feature/guideline-blank-lines
Best Practice: Avoid too many Blank Lines
2022-04-06 21:16:32 +02:00
Christian Bräunlich
ae3a259f58
update example headers 2022-04-05 23:06:54 +02:00
Henrik Helgesen
155be51972
Merge pull request #160 from christianbraeunlich/feature/when-not-to-use-blank-lines
Best Practice: When not to use blank lines
2022-04-05 09:34:22 -07:00
Jeremy Vyska
9a6f6e5b8b
Very minor language tweaks
Otherwise, solid :)
2022-04-05 14:31:07 +02:00
waldo
17f423f02c
Merge pull request #170 from christianbraeunlich/patch-1
correct sentence
2022-04-05 14:17:18 +02:00
Christian Bräunlich
0bed50ad01
correct sentence 2022-04-02 18:29:51 +02:00
waldo
3684393375
Merge pull request #167 from StefanMaron/patch-1
Added Rec. to the API Page code Example
2022-03-30 11:28:08 +02:00
Stefan Maroń
6b80f47379
Added Rec. to the API Page code Example 2022-03-30 09:45:26 +02:00
christianbraeunlich
b20535245b added suggestions by TheDoubleH 2022-03-26 09:11:01 +01:00
Jeremy Vyska
1653ec32cc
Merge pull request #156 from christianbraeunlich/feature/correct-sentences
Correct sentences
2022-03-25 16:08:58 +01:00
Jeremy Vyska
6dc0ae6f2d
Merge pull request #159 from christianbraeunlich/hotfix/indentation-in-best-practice
Added indentation for best practices
2022-03-25 16:08:04 +01:00
Henrik Helgesen
417cc2f025
Update content/docs/BestPractices/CustomTelemetry/index.md
Removed the word period
2022-03-24 14:50:26 -07:00
christianbraeunlich
6915945e92 added when-not-to-use-blank-lines 2022-03-19 23:04:56 +01:00
christianbraeunlich
83053e7287 added indentation 2022-03-19 22:12:39 +01:00
christianbraeunlich
0c5f3b319d added captions 2022-03-19 21:35:07 +01:00
christianbraeunlich
16aaca3614 added some blank lines examples 2022-03-19 20:54:06 +01:00
christianbraeunlich
7cf65b3d3b initial "avoid too many blank lines" best practice 2022-03-17 23:03:42 +01:00
christianbraeunlich
42358aab34 added period at the end 2022-03-17 21:56:01 +01:00
christianbraeunlich
bb587c5d09 change wit to with 2022-03-17 21:49:35 +01:00
Henrik Helgesen
4fbfc28c9e
Merge pull request #142 from waldo1001/main
Cosmetic changes
2022-03-11 03:04:35 -08:00
Patrick Schiefer
f892465759 Descpription 2022-03-09 16:18:49 +01:00
Patrick Schiefer
19ca096afe Update Description 2022-03-09 16:16:29 +01:00
Jeremy Vyska
ed09a81f6a
Merge pull request #146 from christianbraeunlich/feature/mermaid
Docsy - Diagrams with Mermaid
2022-03-08 09:08:58 +01:00
Christian Bräunlich
75dd79f904
added mermaid to formatting tips 2022-03-06 18:22:58 +01:00
Christian Bräunlich
d5fb3894ec
added mermaid feature 2022-03-06 17:49:23 +01:00
Patrick Schiefer
f40daf4b1f added command queue 2022-03-05 19:43:29 +01:00
waldo
b8b9b16998
Merge pull request #143 from tfenster/main
Support devcontainer (local and GH Codespaces)
2022-03-02 15:31:58 +01:00
Tobias Fenster
408368b3de
add initial checks if it doesn't work 2022-03-02 12:28:41 +01:00
Tobias Fenster
cda4104e61 add explanation for switching 2022-03-02 10:54:35 +00:00
waldo
78d169687a
Update content/docs/BestPractices/CustomTelemetry/index.md
Co-authored-by: Henrik Helgesen <henrik@helgesen.consulting>
2022-03-02 10:04:47 +01:00
Tobias Fenster
99e883f0c6
change headline level 2022-03-02 07:34:15 +01:00
Tobias Fenster
e8a856f625 docs for devcontainer 2022-03-01 23:39:41 +00:00
Tobias Fenster
faf2dbdc0a weird error 2022-03-01 22:26:20 +00:00
Tobias Fenster
819d05a9ca add npm on init 2022-03-01 22:20:58 +00:00
Tobias Fenster
9cdaaf3a39 add support for devcontainers and direct run 2022-03-01 22:17:44 +00:00
waldo
bfc249435d Cosmetic changes 2022-03-01 16:40:01 +01:00
waldo
c2804fc330
Merge pull request #141 from TheDoubleH/main
Update Front Page 'Whats New'
2022-03-01 09:30:09 +01:00
Henrik Helgesen
798ed63b53 Update Front Page 'Whats New' 2022-02-28 14:04:33 -08:00
waldo
d2725b5bf0
Merge pull request #139 from microsoft/jv/no-series
Revived Pattern: Number Series
2022-02-28 22:40:28 +01:00
Jeremy Vyska
a4a46ab85a Added Journal NoSeries info 2022-02-27 22:09:51 +01:00
Jeremy Vyska
24f04c7fda Fixing formatting, adding clarity, WITH warn 2022-02-27 21:48:06 +01:00
Jeremy Vyska
9b97d1151e
Update content/docs/patterns/no-series/index.md
Co-authored-by: Henrik Helgesen <henrik@helgesen.consulting>
2022-02-27 21:28:29 +01:00
Jeremy Vyska
d7792f5489
Update content/docs/patterns/no-series/index.md
Co-authored-by: Henrik Helgesen <henrik@helgesen.consulting>
2022-02-27 21:28:21 +01:00
Jeremy Vyska
ccbf573ec8
Update content/docs/patterns/no-series/index.md
Co-authored-by: Henrik Helgesen <henrik@helgesen.consulting>
2022-02-27 21:28:15 +01:00
Jeremy Vyska
8543650944
Update content/docs/patterns/no-series/index.md
Co-authored-by: Henrik Helgesen <henrik@helgesen.consulting>
2022-02-27 21:27:58 +01:00
Henrik Helgesen
13beb2fee6
Correct Typo
Tags are not tages
2022-02-27 11:23:04 -08:00
Henrik Helgesen
7f492b2c47
Merge pull request #137 from microsoft/ajk/api-register-fieldset
New pattern API Register Fieldset
2022-02-27 11:15:08 -08:00
Henrik Helgesen
615864e950
Merge pull request #136 from microsoft/ajk/delegate-api-operation
Pattern added Delegate API operation
2022-02-27 11:13:04 -08:00
Henrik Helgesen
8424546db5
Merge pull request #135 from microsoft/ajk/api-page
New guideline API page
2022-02-27 11:10:28 -08:00
Henrik Helgesen
58db3a3a3c
Merge pull request #138 from microsoft/waldo/somechanges
Add AuthorName - just because we can ;-)
2022-02-27 10:59:14 -08:00
Jeremy Vyska
2ba8365e37 Revived Pattern: Number Series 2022-02-27 17:41:39 +01:00
waldo1001
8503a84609 Add AuthorName - just because we can ;-) 2022-02-27 16:37:58 +01:00
waldo
c41d4e9e24
Merge pull request #134 from microsoft/ajk/CustomTelemetry
Add guideline CustomTelemetry
2022-02-27 15:08:19 +01:00
Arend-Jan Kauffmann
496f1a6b47 New pattern API Register Fieldset 2022-02-27 00:01:34 +01:00
Arend-Jan Kauffmann
55a705376f Pattern added Delegate API operation 2022-02-26 22:44:51 +01:00
Arend-Jan Kauffmann
2ec683b653 New guideline API page 2022-02-26 20:59:34 +01:00
Arend-Jan Kauffmann
fb6a07a1ee Resolve comments + extra chapter 2022-02-26 17:05:49 +01:00
Arend-Jan Kauffmann
bc45439b53 Add guideline CustomTelemetry 2022-02-25 23:13:54 +01:00
Henrik Helgesen
80b377d382
Merge pull request #125 from TheDoubleH/InstallHugoOnWindows11
Install hugo on windows11
2022-02-25 08:46:22 -08:00
Henrik Helgesen
1486266329
Merge branch 'main' into InstallHugoOnWindows11 2022-02-25 08:45:57 -08:00
Henrik Helgesen
1e5fd62577
Merge pull request #133 from TheDoubleH/CleanupDiscussion
Removed Discussion Links. Using new Theme solution.
2022-02-25 08:45:12 -08:00
Henrik Helgesen
fb17dc9640 Removed Discussion Links. Using new Theme solution.
Some additional MDLint cleanup as well
2022-02-24 15:36:06 -08:00
Henrik Helgesen
cd3497d542
Merge pull request #126 from microsoft/docsy-theme-redo
Revert site logo to official Microsoft iconography
2022-02-24 14:25:57 -08:00
Arend-Jan Kauffmann
d6a2ff9437
Merge pull request #127 from microsoft/waldo_tags
Added tags & categories + cleanup
2022-02-24 22:02:48 +01:00
Jeremy Vyska
917c31fa8c Style improvements 2022-02-24 21:56:08 +01:00
Jeremy Vyska
32273fd1ec Github Link section revision 2022-02-24 21:49:57 +01:00
waldo
743886be65
Merge pull request #128 from microsoft/waldo1001-patch-2
Update _index.md
2022-02-24 21:06:46 +01:00
waldo
5e676054d9
Update _index.md 2022-02-24 21:06:30 +01:00
Henrik Helgesen
44f4036e67 Merge branch 'main' into InstallHugoOnWindows11 2022-02-24 11:29:53 -08:00
waldo1001
5ee0436639 Added tags & categories + cleanup 2022-02-24 14:45:35 +01:00
Henrik Helgesen
a5ea50694e Merge branch 'InstallHugoOnWindows11' of https://github.com/TheDoubleH/alguidelines into InstallHugoOnWindows11 2022-02-24 02:42:16 -08:00
Henrik Helgesen
d521d3baa8 Install via Powersehll 2022-02-24 02:42:12 -08:00
Jeremy Vyska
ee09ec590d
Update _index.md
A few small proofreading tweaks, but otherwise looks solid.
2022-02-24 07:46:26 +01:00
Jeremy Vyska
05c86e17a0 Revert site logo to official Microsoft iconography 2022-02-24 07:39:39 +01:00
Henrik Helgesen
5a85dcee51 Remove extra blank line 2022-02-23 15:30:46 -08:00
Henrik Helgesen
b15b08473b Install Hugo on Win 11 2022-02-23 15:26:56 -08:00
waldo
4515a721bd
Merge pull request #124 from microsoft/waldo1001-patch-1
Update _index.md
2022-02-23 23:43:09 +01:00
Henrik Helgesen
c995aa42da MD Lint Cleanup / Added Discussion Links 2022-02-23 01:09:10 -08:00
298 changed files with 14107 additions and 1060 deletions

27
.devcontainer/Dockerfile Normal file
View file

@ -0,0 +1,27 @@
# syntax=docker/dockerfile:1
FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04
# VARIANT can be either 'hugo' for the standard version or 'hugo_extended' for the extended version.
ARG VARIANT=hugo_extended
# VERSION can be either 'latest' or a specific version number
ARG VERSION=latest
# Download Hugo
RUN case ${VERSION} in \
latest) \
export VERSION=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}') ;;\
esac && \
echo ${VERSION} && \
case $(uname -m) in \
aarch64) \
export ARCH=ARM64 ;; \
*) \
export ARCH=64bit ;; \
esac && \
echo ${ARCH} && \
wget -O ${VERSION}.tar.gz https://github.com/gohugoio/hugo/releases/download/v${VERSION}/${VARIANT}_${VERSION}_Linux-${ARCH}.tar.gz && \
tar xf ${VERSION}.tar.gz && \
mv hugo /usr/bin/hugo
# Hugo dev server port
EXPOSE 1313

View file

@ -0,0 +1,35 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.217.4/containers/hugo
{
"name": "Hugo",
"build": {
"dockerfile": "Dockerfile"
},
"customizations": {
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"html.format.templating": true
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"bungcip.better-toml",
"davidanson.vscode-markdownlint",
"GitHub.vscode-pull-request-github"
]
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
1313
],
"remoteUser": "vscode",
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": ""
"features": {
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/go:1": {},
"ghcr.io/devcontainers/features/hugo:1": {},
"ghcr.io/devcontainers/features/node:1": {}
}
}

8
.gitattributes vendored Normal file
View file

@ -0,0 +1,8 @@
* text=auto eol=lf
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf
*.gif binary
*.jpeg binary
*.png binary
*.gz binary
*.jar binary

73
.github/workflows/hugo.yml vendored Normal file
View file

@ -0,0 +1,73 @@
# Sample workflow for building and deploying a Hugo site to GitHub Pages
name: Deploy Hugo site to Pages
on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
# Default to bash
defaults:
run:
shell: bash
jobs:
# Build job
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.151.0
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass
run: sudo snap install dart-sass
- name: Checkout
uses: actions/checkout@v3
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: Install Node.js dependencies
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
- name: Build with Hugo
env:
# For maximum backward compatibility with Hugo modules
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
hugo \
--minify \
--baseURL "${{ steps.pages.outputs.base_url }}/"
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./public
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

View file

@ -1,49 +0,0 @@
name: hugo CI
on:
push:
branches:
- main # Set a branch name to trigger deployment
pull_request:
jobs:
deploy:
runs-on: ubuntu-20.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v2
with:
submodules: recursive # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true # Use extended Hugo
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Prepare postcss-cli
run: npm ci
- name: Build
run: hugo --minify
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public

3
.gitmodules vendored
View file

@ -1,3 +0,0 @@
[submodule "themes/docsy"]
path = themes/docsy
url = https://github.com/google/docsy.git

11
.vscode/tasks.json vendored Normal file
View file

@ -0,0 +1,11 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Start local Hugo server",
"type": "shell",
"command": "hugo serve",
"problemMatcher": []
}
]
}

23
CITATION.cff Normal file
View file

@ -0,0 +1,23 @@
cff-version: 1.2.0
title: ALGuidelines.dev
abstract: |
"Microsoft ALGuidelines - A Community driven project.
Best Practices and Design Patterns for the AL Language."
keywords:
- AL
- "Design Patterns"
- "Best Practices"
authors:
- given-names: Eric
family-names: Wauters
- given-names: Arend-Jan
family-names: Kauffmann
- given-names: Henrik
family-names: Helgesen
orcid: https://orcid.org/0000-0002-3281-6712
- given-names: Jeremy
family-names: Vyska
license: MIT
url: "https://alguidelines.dev"
repository-code: "https://github.com/microsoft/alguidelines"

View file

@ -40,14 +40,7 @@ contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additio
### Setup ### Setup
1. Clone and setup **Run Hugo server**
```sh
# Clone all submodules
git submodule update --init --recursive --depth 1
# Install NPM dependencies
npm install
```
2. Run Hugo server
``` ```
$ hugo server $ hugo server
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1) Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 279 KiB

View file

@ -1,2 +1,7 @@
.td-page-meta--child { display: none !important; } .td-page-meta--child { display: none !important; }
.td-page-meta--project-issue { display: none !important; } .td-page-meta--project-issue { display: none !important; }
.td-content pre code {
font-family: Consolas, "Courier New", monospace;
size: 115%;
}

View file

@ -1,21 +0,0 @@
+++
chapter = true
pre = "<b><i class='fas fa-clone'></i> </b>"
title = "Discussions"
weight = 200
+++
# [Discussions](https://github.com/microsoft/alguidelines/discussions)
We enabled the "Discussions" forum on the github-page of our repository for you to discuss anything "Design Pattern" or "Best Practices" related.
You can find the discussions here: https://github.com/microsoft/alguidelines/discussions.
Feel free to browse through them, find certain topics and/or participate in the discussions!
## Create your own discussion
You are obviously also free to start a new discussion. You can simply do that by using the "New Discussion" button on the top right.
Or use this link: https://github.com/microsoft/alguidelines/discussions/new?category=bc-patterns

View file

@ -123,16 +123,16 @@ images: ["images/og-image-fission.png"]
</div> </div>
<div class="col-lg-4"> <div class="col-lg-4">
<div class="card-shadow"> <div class="card-shadow">
<span class="card-badge">PATTERN</span> <span class="card-badge">NEW</span>
<h4 class="section-text-bold mt-4"> <h4 class="section-text-bold mt-4">
Event Bridge Getting Started With Agentic Coding
</h4> </h4>
<div class="card-shadow-content"> <div class="card-shadow-content">
<p class="section-text"> <p class="section-text">
In the world of interfaces, it is important to preserve (certain) events over multiple implementation of the interface. Essential concepts and practices for working with AI coding assistants in your AL development workflow.
</p> </p>
<a href="/docs/patterns/event-bridge-pattern/"> <a href="/docs/agentic-coding/gettingstarted/">
<button class="hero-mid align-self-end">Read Now</button> <button class="hero-mid-2 align-self-end">Get Started</button>
</a> </a>
</div> </div>
</div> </div>
@ -140,16 +140,16 @@ images: ["images/og-image-fission.png"]
<div class="col-lg-4"> <div class="col-lg-4">
<div class="card-shadow"> <div class="card-shadow">
<span class="card-badge">BEST PRACTICE</span> <span class="card-badge">GUIDE</span>
<h4 class="section-text-bold mt-4"> <h4 class="section-text-bold mt-4">
CASE Action on next line Vibe Coding Rules
</h4> </h4>
<div class="card-shadow-content"> <div class="card-shadow-content">
<p class="section-text"> <p class="section-text">
A CASE action should start on a line after the possibility. AI-optimized coding rules and guidelines designed to enhance the AL developer experience in modern AI-powered IDEs.
</p> </p>
<a href="/docs/bestpractices/case-actions/" <a href="/docs/agentic-coding/vibe-coding-rules/"
><button class="hero-mid-2 align-self-end">Read Now</button></a ><button class="hero-mid-2 align-self-end">Explore Rules</button></a
> >
</div> </div>
</div> </div>
@ -157,17 +157,17 @@ images: ["images/og-image-fission.png"]
<div class="col-lg-4"> <div class="col-lg-4">
<div class="card-shadow"> <div class="card-shadow">
<span class="card-badge">PATTERN</span> <span class="card-badge">TOOLS</span>
<h4 class="section-text-bold mt-4"> <h4 class="section-text-bold mt-4">
Façade Agentic Tools
</h4> </h4>
<div class="card-shadow-content"> <div class="card-shadow-content">
<p class="section-text"> <p class="section-text">
The intent of this pattern is to provide a unified API to a single or a collection of potentially complex subsystems. Model Context Protocol (MCP) servers that enhance AI assistants for Business Central development workflows.
</p> </p>
<a <a
href="/docs/patterns/facade-pattern/" href="/docs/agentic-coding/communityresources/tools/"
><button class="hero-mid-2 align-self-end">Read Now</button></a ><button class="hero-mid-2 align-self-end">Explore Tools</button></a
> >
</div> </div>
</div> </div>
@ -210,17 +210,6 @@ images: ["images/og-image-fission.png"]
</p> </p>
</div> </div>
</a> </a>
<a href="https://twitter.com/search?q=%23bcalhelp">
<div class="card-shadow twitter-card" style="margin-left: auto">
<div class="card-header-custom">
<h2 style="padding-right: 0.8rem;"><i class="fab fa-twitter"></i></h2>
<h2 class="section-text-bold">Twitter</h2>
</div>
<p class="section-text">
Chat about this with the <b class="text-highlight">#bcalhelp</b> hashtag.
</p>
</div>
</a>
</div> </div>
</div> </div>
</div> </div>
@ -254,22 +243,6 @@ images: ["images/og-image-fission.png"]
</div></a </div></a
> >
</div> </div>
<div class="col-lg-6">
<a href="https://twitter.com/search?q=%23bcalhelp"
><div
class="card-shadow twitter-card-desktop"
style="margin-left: auto"
>
<div class="card-header-custom">
<h2 style="padding-right: 0.8rem;"><i class="fab fa-twitter"></i></h2>
<h2 class="section-text-bold">Twitter</h2>
</div>
<p class="section-text">
Chat about this with the <b class="text-highlight">#bcalhelp</b> hashtag.
</p>
</div></a
>
</div>
</div> </div>
</div> </div>
</div> </div>

View file

@ -0,0 +1,96 @@
---
title: "Custom Telemetry"
tags: ["AL","Telemetry"]
categories: ["Best Practice"]
---
_Created by Microsoft, Described by Arend-Jan Kauffmann_
## Description
With AL it is possible to emit custom telemetry signals to Azure Application Insights. There are a number of considerations that you should keep in mind when designing custom telemetry signals.
- Think about it as an API
- Naming conventions and telemetry schema
- Objects emitting telemetry signals
- Candidate data for telemetry
- How customers use telemetry
- Privacy
## Think about it as an API
Customers will build analytics and monitoring solutions on top of their telemetry data.
Therefore, signal must be treated as any other API
- documented
- versioned
- discoverable
- non-breaking
## Naming conventions and telemetry schema
To make it easy for the consumer of telemetry to work with the data, please
- use **PascalCasing**. This makes all fields in Application Insights look the same (signal logged through the AL LogMessage method will have "al" prefixed to dimension names.
- **Do not use special characters or spaces** for fields/custom dimension keys. This makes the KQL queries so much easier to write
- for custom dimensions, consider using prefixes that helps the telemetry consumer understand where the dimension is coming from (e.g. HttpStatusCode, SqlStatement, ...)
Consider always having a **"message"** field that expresses in human readable form what the telemetry event is about.
If you do, let message names follow the Object ActionInPastTense pattern
Some examples
- Web Service Called:
- Email attempt failed
- Authorization to environment succeeded
```al
local procedure ProcessHttpResponse(var Request: HttpRequestMessage; var Response: HttpResponseMessage)
var
CustomTelemetryDimensions: Dictionary of [Text,Text];
begin
if Response.HttpStatusCode <> 200 then begin
CustomTelemetryDimensions.Add('Url', Request.GetRequestUri);
CustomTelemetryDimensions.Add('HttpStatusCode', Format(Response.HttpStatusCode));
CustomTelemetryDimensions.Add('ReasonPhrase', Response.ReasonPhrase);
Session.LogMessage(
'MyExt0001',
'Web service call failed',
Verbosity::Error,
DataClassification::SystemMetadata,
TelemetryScope::ExtensionPublisher,
CustomTelemetryDimensions);
end;
end;
```
## Objects emitting telemetry signals
Telemetry data includes information about the object that emitted the telemetry signal. It's recommended to call Session.LogMessage() **from within the object** that causes a situation that you want to have telemetry for. That will make it easier to analyze where exactly in the code an issue occurred.
Of course it is possible to have a single object as a central place to emit telemetry signals. The telemetry data includes a callstack, so eventually it would be possible to trace back to the exact place where an issue occurred. But that requires a more complicated query, so it would be better to emit telemetry signals right from place in the code where an issue occurred.
## Candidate data for telemetry
Telemetry must be **actionable** for the customer. Do not emit signals that they cannot act on (knowing about CPU performance counters on the database is useless if the partner cannot scale the database).
Also, note that customers pay for data ingestion. So be mindful to not flood their telemetry resources. Consider to use TelemetryScope::ExtensionPublisher by default and only use TelemetryScope::All in case the customer can also act on the data.
If you do not know where to start, consider using telemetry for deflection. In Dynamics 365 Business Central, they started with signal about authorization (successful/failed) to deflect support cases that was due to disabled users/wrong licenses.
## How customers use telemetry
The following are known scenarios for customer telemetry
- The tenant admin (typically an IT-pro) wants to troubleshoot a performance problem and they need more details than what is provided in the analytics reports in the admin center.
- The customer wants to analyze (and correct) errors happening in the environment (typically an IT-pro)
- The customer wants to analyze usage of features (typically an analytics user, maybe with BI experience)
Customers typically start in the Application Insights portal and then move on to use more advanced tools for analytics (KQL, Power BI, Excel, ...). Once they have seen the light, they will likely start alerting on telemetry using Azure Monitor Alerts or setting up Power Automate flows.
Business Central have developed a telemetry maturity model (based on the Gartner BI maturity model) for how organizations can evolve to use telemetry proactively in their business processes.
## Privacy
Telemetry must be **privacy compliant**.
For privacy reasons, events that have a DataClassification other than SystemMetadata aren't sent to Application Insight resources set up on the tenant. During development of your extension, it's good practice to have a privacy review of the use of LOGMESSAGE calls to ensure that customer data isn't mistakenly leaked into Application Insights resources.

View file

@ -1,10 +1,10 @@
--- ---
title: "DeleteAll" title: "DeleteAll"
tags: ["Performance"] tags: ["AL","Performance"]
categories: ["Best Practice"] categories: ["Best Practice"]
--- ---
<_Created by waldo, Described by waldo_\> _Created by waldo, Described by waldo_
## Description ## Description
@ -25,11 +25,3 @@ Therefore it's good practice to always check if the table is empty when performi
if not EmptyTableWLD.IsEmpty() then if not EmptyTableWLD.IsEmpty() then
EmptyTableWLD.DeleteAll(true); EmptyTableWLD.DeleteAll(true);
``` ```
## Discussions
You can discuss the guideline [here](https://github.com/microsoft/alguidelines/discussions/107)
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices).
If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article.

View file

@ -0,0 +1,69 @@
---
title: "SetLoadFields"
tags: ["AL","Readability"]
categories: ["Best Practice"]
---
See the documentation on learn.microsoft.com for more information about [SetLoadFields](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/record/record-setloadfields-method).
For the performance of your code it is important that you use SetLoadFields as much as possible.
If you want to retrieve a record from the database to check if the record is available always use SetLoadFields on the primary key fields of the table so only those fields will be retrieved from the database.
## Bad code
```AL
if not Item.Get(ItemNo) then
exit();
```
## Good code
```AL
Item.SetLoadFields("No.");
if not Item.Get(ItemNo) then
exit();
```
Place the SetLoadFields in the code before the line of the Get (or find). (there is no need to record filter fields in the SetLoadFields because these will be retrieved automatically).
## Bad code
```AL
Item.SetLoadFields("Item Category Code");
Item.SetRange("Third Party Item Exists", false);
Item.FindFirst();
```
## Good code
```AL
Item.SetRange("Third Party Item Exists", false);
Item.SetLoadFields("Item Category Code");
Item.FindFirst();
```
Place the SetLoadFields in the code before the case statement
## Bad code
```AL
Item.SetLoadFields("Item Category Code");
ItemCategoryCode := FindItemCategoryCode;
case true of
Item.Get(ItemNo):
SetItemCategoryCode(Item, ItemCategoryCode);
end;
```
## Good code
```AL
ItemCategoryCode := FindItemCategoryCode;
Item.SetLoadFields("Item Category Code");
case true of
Item.Get(ItemNo):
SetItemCategoryCode(Item, ItemCategoryCode);
end;
```

View file

@ -1,6 +1,6 @@
--- ---
title: "Subscriber Codeunits" title: "Subscriber Codeunits"
tags: ["Performance"] tags: ["AL","Performance"]
categories: ["Best Practice"] categories: ["Best Practice"]
--- ---
@ -18,15 +18,18 @@ In general, subscribers have to be put in codeunits. There are a few performanc
Let's discuss all points Let's discuss all points
## Keep the codeunit as small as possible ## Keep the codeunit as small as possible
Every time a subscriber gets called, a new instance of the codeunit is being loaded in memory, which takes memory and processing power. The smaller the codeunit, the less memory, and the faster it is. Every time a subscriber gets called, a new instance of the codeunit is being loaded in memory, which takes memory and processing power. The smaller the codeunit, the less memory, and the faster it is.
Therefore, it's suggested to split the subscribers by functionality and avoid putting business logic in the actual codeunit. Tip: put all business logic in an "[Method Codeunit](https://alguidelines.dev/bcpatterns/generic-method-pattern/)". Therefore, it's suggested to split the subscribers by functionality and avoid putting business logic in the actual codeunit. Tip: put all business logic in an "[Method Codeunit](https://alguidelines.dev/docs/patterns/generic-method-pattern/)".
Examples: Examples:
- if you app does things on Sales and Purchase, create a Sales-subs codeunit, and a Purchase-subs. - if you app does things on Sales and Purchase, create a Sales-subs codeunit, and a Purchase-subs.
- if you have multiple functionalities in your app (let's call'm modules), create a subs-codeunit per module, and only add the subscribers in there that are necessary for that module. - if you have multiple functionalities in your app (let's call'm modules), create a subs-codeunit per module, and only add the subscribers in there that are necessary for that module.
### Bad code ### Bad code
```AL ```AL
codeunit 2037325 "Setup Subs" codeunit 2037325 "Setup Subs"
{ {
@ -73,6 +76,7 @@ codeunit 2037325 "Setup Subs"
end; end;
} }
``` ```
### Good code ### Good code
Split into 2 codeunits, and move the business logic out. Split into 2 codeunits, and move the business logic out.
@ -112,6 +116,7 @@ codeunit 2037324 "RHE Setup Subs"
To avoid the extra "loading of the content" while a subscriber is being executed, use Single Instance codeunit for subscribers. Do take into account, of course, that it would share the state across the entire session. To avoid the extra "loading of the content" while a subscriber is being executed, use Single Instance codeunit for subscribers. Do take into account, of course, that it would share the state across the entire session.
### Bad code ### Bad code
```AL ```AL
codeunit 2037324 "RHE Setup Subs" codeunit 2037324 "RHE Setup Subs"
{ {
@ -124,7 +129,9 @@ codeunit 2037324 "RHE Setup Subs"
end; end;
} }
``` ```
### Good code ### Good code
```AL ```AL
codeunit 2037324 "RHE Setup Subs" codeunit 2037324 "RHE Setup Subs"
{ {
@ -145,6 +152,7 @@ codeunit 2037324 "RHE Setup Subs"
If possible, only execute the subscriber when really necessary by using Manual Binding. If possible, only execute the subscriber when really necessary by using Manual Binding.
### Bad code ### Bad code
```AL ```AL
//subscriber - code should actually only run when Color=Red. //subscriber - code should actually only run when Color=Red.
[EventSubscriber(ObjectType::Table, Database::"Just Some Table WLD", 'OnAfterValidateEvent', 'Message 2', false, false)] [EventSubscriber(ObjectType::Table, Database::"Just Some Table WLD", 'OnAfterValidateEvent', 'Message 2', false, false)]
@ -162,7 +170,9 @@ If possible, only execute the subscriber when really necessary by using Manual B
JustSomeTable.Validate("Message 2", format(Random(1000))); JustSomeTable.Validate("Message 2", format(Random(1000)));
until JustSomeTable.Next() < 1; until JustSomeTable.Next() < 1;
``` ```
### Good code ### Good code
```AL ```AL
if JustSomeTable.FindSet() then if JustSomeTable.FindSet() then
repeat repeat
@ -177,21 +187,15 @@ If possible, only execute the subscriber when really necessary by using Manual B
``` ```
## Avoid OnInsert/OnModify/OnDelete ## Avoid OnInsert/OnModify/OnDelete
The reason for this is, that it breaks the batch-calls: The reason for this is, that it breaks the batch-calls:
- Any "OnInsert" subscriber breaks the bulk inserts, simply because it needs to perform an operation after every record that was inserted - Any "OnInsert" subscriber breaks the bulk inserts, simply because it needs to perform an operation after every record that was inserted
- Any "OnModify" subscriber slows down the "ModifyAll", simply because it needs to perform an operation after every record that was modified. I fact: 1 SQL call is turned into a loop of SQL calls. - Any "OnModify" subscriber slows down the "ModifyAll", simply because it needs to perform an operation after every record that was modified. I fact: 1 SQL call is turned into a loop of SQL calls.
- Any "OnDelete" subscriber slows down the "DeleteAll", simply because it needs to perform an operation after every record that was deleted. I fact: 1 SQL call is turned into a loop of SQL calls. - Any "OnDelete" subscriber slows down the "DeleteAll", simply because it needs to perform an operation after every record that was deleted. I fact: 1 SQL call is turned into a loop of SQL calls.
Avoid subscribers to these events. Avoid subscribers to these events.
## [Discussions](https://github.com/microsoft/alguidelines/discussions/92)
You can discuss this guidelines [here](https://github.com/microsoft/alguidelines/discussions/92).
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices).
If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article.
## References ## References
The [Generic Method Pattern](https://alguidelines.dev/bcpatterns/generic-method-pattern/) The [Generic Method Pattern](https://alguidelines.dev/docs/patterns/generic-method-pattern/)

View file

@ -5,8 +5,6 @@ description: >
AL Code Best Practices AL Code Best Practices
--- ---
# Business Central Best Practices
This section will be cover things that aren't as simple as Design Patterns, but will help make sure your development is: This section will be cover things that aren't as simple as Design Patterns, but will help make sure your development is:
- high-performance - high-performance

View file

@ -0,0 +1,187 @@
---
title: "API Page / Query"
tags: ["AL","API"]
categories: ["Best Practice"]
---
_Created by Arend-Jan Kauffmann, Described by Arend-Jan Kauffmann_
## Description
API pages are different from UI pages. They require different properties and don't behave the same. Because API pages are used for integration with external applications, they should be treated as contracts. To achieve this, the following topics are important.
- Separate API app
- Page properties
- Versioning
- Field properties
- Default fields
## Separate API app
It's a good practice to develop API pages in a separate app instead of combining them in a solution. By doing so, it provides better maintainability and is a good way of separation of concerns.
## Page properties
An API page must define a minimum set of properties. Some of these properties will be part of the URL of the API endpoint. It is recommended to define the properties in the same order as they appear in the URL.
The properties that must be defined are:
- PageType = API / QueryType = API
- APIPublisher
- APIGroup
- APIVersion
- EntitySetName
- EntityName
- DelayedInsert (only Page)
- ODataKeyFields
### APIPublisher
The name of the API publisher is usually the company creating the API. It is the first custom part in the URL for a given endpoint. While the value is case insensitive for HTTP operations (GET, POST, etc.), it is case sensitive when checking for active subscriptions.
Example:
```al
APIPublisher = 'contoso';
```
### APIGroup
Sets the group of the API endpoint that page or query is exposed in. In the URL the APIGroup comes after the APIPublisher. It can be used to distinguish different API apps or groups of APIs from each other. While the value is case insensitive for HTTP operations (GET, POST, etc.), it is case sensitive when checking for active subscriptions.
Example:
```al
APIGroup = 'app1';
```
### APIVersion
Sets the version(s) of the API endpoint the page or query is exposed in. This property is not mandatory. If it is not specified, then APIs will be exposed as version 'beta'.
The APIVersion can be set to 'beta' or have the format 'vx.y'.
Example:
```al
APIVersion = 'beta';
```
or
```al
APIVersion = 'v1.0';
```
#### _Multiple API versions_
You should __never__ break existing versions. Any breaking change requires to create a new version.
It is possible to expose an API in multiple versions:
```al
APIVersion = 'beta', 'v1.0';
```
This allows to publish a new version of an API app without copying all individual objects and updating the version numbers. Only those API objects that are changed in a new version need to be copied. The other objects only need an addition to the APIVersion property to become available in the new version endpoint.
### EntitySetName
The EntitySetName is the plural entity name. Think of it as the name of the collection of entities. It is recommended to use camelCasing for this property. The value is case sensitive!
Example:
```al
EntitySetName = 'itemCategories';
```
### EntityName
The EntityName sets the singular entity name for the API page or query. This name is not used in the URL. Instead, the EntityName is used in the metadata information. It is recommended to use camelCasing for this property.
Example:
```al
EntityName = 'itemCategory';
```
### DelayedInsert
This property is required on an editable API page. It does not apply to an API query object. If ```Editable = false``` is set on the API page, then DelayedInsert is not required.
All APIs pages apply the behavior to first specify all field values and then insert the record at once.
Example:
```al
DelayedInsert = true;
```
### Full example
Together, the page properties look like:
```al
PageType = API;
APIPublisher = 'contoso';
APIGroup = 'app1';
APIVersion = 'v1.0';
EntitySetName = 'itemCategories';
EntityName = 'itemCategory';
DelayedInsert = true;
```
The full url will look like: ```https://{url}/api/contoso/app1/v1.0/companies({id})/itemCategories```
### ODataKeyFields
The ```EntitySetName``` property in the URL can be extended with an identifier to indicate a single record.
Example:
```
.../itemCategories(768b6173-9b19-40ea-8e5d-ce181ec0d645)
```
The property ```ODataKeyFields``` defines which field(s) will be used for the identifier value. It is highly recommended to always use the SystemId field for this property. The SystemId field is immutable and will never change for a record.
The field that is defined in this property should be part of the API page.
## Field properties
The base structure of an API page is similar to a UI list page:
```al
layout
{
area(Content)
{
repeater(records)
{
...
}
}
}
```
When specifying the fields there are some considerations to keep in mind.
```
field(displayName; Rec.Name) { }
```
There are no mandatory properties. The property ```ApplicationArea``` does not play a role in API pages, so it can be skipped. The property ```Caption``` is also optional and should only be used in case the external application requires captions and the caption should be different from the standard caption as defined in the table.
The name of the field, in the example above ```displayName```, should be defined in camelCasing. It may not contain spaces, dots, or other special characters.
It is common use to give certain fields a more describing name. Some examples are:
* id for field SystemId
* number for field "No."
* displayName for field Name
## Mandatory fields
These fields should always be part of the API Page:
* SystemId
* This field should be exposed with the name ```id```
* SystemModifiedAt
* This field should be exposed with the name ```lastModifiedDateTime```. If you choose a different name, then the webhook functionality will not work properly.
Example:
```al
layout
{
area(Content)
{
repeater(records)
{
field(id; Rec.SystemId) { }
field(lastModifiedDateTime; Rec.SystemModifiedAt) { }
}
}
}
```

View file

@ -1,6 +1,6 @@
--- ---
title: "begin as an afterword" title: "begin as an afterword"
tags: ["Readability"] tags: ["AL","Readability"]
categories: ["Best Practice"] categories: ["Best Practice"]
--- ---
@ -26,9 +26,3 @@ When `begin` follows `then`, `else`, `do`, it should be on the same line, preced
... ...
end; end;
``` ```
## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=begin+as+an+After+Word+category%3A%22BC+Best+Practices%22)
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices).
If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article.

View file

@ -1,6 +1,6 @@
--- ---
title: "Begin-End - Compound Only" title: "Begin-End - Compound Only"
tags: ["Readability"] tags: ["AL","Readability"]
categories: ["Best Practice"] categories: ["Best Practice"]
--- ---
@ -8,7 +8,9 @@ _Created by Microsoft, Described by waldo_
Only use begin..end to enclose [compound statements](https://docs.microsoft.com/en-us/cpp/c-language/compound-statement-c?view=msvc-170#:~:text=A%20compound%20statement%20%28also%20called%20a%20%22block%22%29%20typically,appear%20at%20the%20head%20of%20a%20compound%20statement.). Only use begin..end to enclose [compound statements](https://docs.microsoft.com/en-us/cpp/c-language/compound-statement-c?view=msvc-170#:~:text=A%20compound%20statement%20%28also%20called%20a%20%22block%22%29%20typically,appear%20at%20the%20head%20of%20a%20compound%20statement.).
## Bad code ## Example 1
### Bad code
```AL ```AL
if FindSet() then begin if FindSet() then begin
@ -18,7 +20,7 @@ if FindSet() then begin
end; end;
``` ```
## Good code ### Good code
```AL ```AL
if FindSet() then if FindSet() then
@ -27,7 +29,9 @@ if FindSet() then
until next() = 0; until next() = 0;
``` ```
## Bad code ## Example 2
### Bad code
```AL ```AL
if IsAssemblyOutputLine then begin if IsAssemblyOutputLine then begin
@ -35,7 +39,7 @@ if IsAssemblyOutputLine then begin
end; end;
``` ```
## Good code ### Good code
```AL ```AL
if IsAssemblyOutputLine then if IsAssemblyOutputLine then
@ -53,8 +57,9 @@ end else
(not X) (not X)
``` ```
## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=begin+end+compound+only+category%3A%22BC+Best+Practices%22) ## Tips
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). The [AZ AL Dev Tools/AL Code Outline](https://marketplace.visualstudio.com/items?itemName=andrzejzwierzchowski.al-code-outline) extension adds two new commands to Visual Studio Code to remove begin..end around single statements.
If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article. - `Remove Begin..End around Single Statements from the Active Editor` : removes begin..end around single statement from the current editor
- `Remove Begin..End around Single Statements from the Active Project` : removes begin..end around single statement from the current project

View file

@ -1,6 +1,6 @@
--- ---
title: "Binary Operator to Start Line" title: "Binary Operator to Start Line"
tags: ["Readability"] tags: ["AL","Readability"]
categories: ["Best Practice"] categories: ["Best Practice"]
--- ---
@ -25,9 +25,3 @@ Quantity
Quantity - Quantity -
"Quantity Shipped" "Quantity Shipped"
``` ```
## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=binary+operator+to+start+line+category%3A%22BC+Best+Practices%22)
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices).
If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article.

View file

@ -0,0 +1,115 @@
---
title: "When not to use Blank Lines"
tags: ["AL","Readability"]
categories: ["Best Practice"]
---
## Description
Do not use blank lines:
- at the beginning or end of any functions (after `begin` and before `end`)
- inside multiline expression
- after blank lines
## Example 1
### Bad code
```al
procedure MATRIX_OnDrillDown(MATRIX_ColumnOrdinal: Integer)
begin
SetupDrillDownCol(MATRIX_ColumnOrdinal);
DrillDown(false, ValueType);
end;
```
### Good code
```al
procedure MATRIX_OnDrillDown(MATRIX_ColumnOrdinal: Integer)
begin
SetupDrillDownCol(MATRIX_ColumnOrdinal);
DrillDown(false, ValueType);
end;
```
## Example 2
### Bad code
```al
if NameIsValid and
Name2IsValid
then
```
### Good code
```al
if NameIsValid and
Name2IsValid
then
```
## Example 3
### Bad code
```al
var
GLSetup: Record "General Ledger Setup";
GLSetupRead: Boolean;
local procedure GetGLSetup()
begin
if not GLSetupRead then
GLSetup.Get();
GLSetupRead := true;
OnAfterGetGLSetup(GLSetup);
end;
[IntegrationEvent(false, false)]
local procedure OnAfterGetGLSetup(var GLSetup: Record "General Ledger Setup")
begin
end;
```
### Good code
```al
var
GLSetup: Record "General Ledger Setup";
GLSetupRead: Boolean;
local procedure GetGLSetup()
begin
if not GLSetupRead then
GLSetup.Get();
GLSetupRead := true;
OnAfterGetGLSetup(GLSetup);
end;
[IntegrationEvent(false, false)]
local procedure OnAfterGetGLSetup(var GLSetup: Record "General Ledger Setup")
begin
end;
```
## Tips
The [AZ AL Dev Tools/AL Code Outline](https://marketplace.visualstudio.com/items?itemName=andrzejzwierzchowski.al-code-outline) extension adds two new commands to Visual Studio Code to remove empty duplicate lines.
- `Remove Empty Lines from the Active Editor` : removes empty duplicate lines from the current editor
- `Remove Empty Lines from the Active Project` : removes empty duplicate lines from the current project

View file

@ -1,6 +1,6 @@
--- ---
title: "CASE Action on next line" title: "CASE Action on next line"
tags: ["Readability"] tags: ["AL","Readability"]
categories: ["Best Practice"] categories: ["Best Practice"]
--- ---
@ -29,9 +29,3 @@ A CASE action should start on a line after the possibility.
Letter2 := '11'; Letter2 := '11';
end; end;
``` ```
## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=case+action+on+next+line+category%3A%22BC+Best+Practices%22)
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices).
If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article.

View file

@ -1,12 +1,13 @@
--- ---
title: "Comment Spacing" title: "Comment Spacing"
tags: ["Readability"] tags: ["AL","Readability"]
categories: ["Best Practice"] categories: ["Best Practice"]
--- ---
_Created by Microsoft, Described by waldo_ _Created by Microsoft, Described by waldo_
## Description ## Description
Always start comments with // followed by one space character. Always start comments with // followed by one space character.
## Bad code ## Bad code
@ -15,15 +16,8 @@ Always start comments with // followed by one space character.
RowNo += 1000; //Move way below the budget RowNo += 1000; //Move way below the budget
``` ```
## Good code ## Good code
```al ```al
RowNo += 1000; // Move way below the budget RowNo += 1000; // Move way below the budget
``` ```
## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=comment+spacing+category%3A%22BC+Best+Practices%22)
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices).
If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article.

View file

@ -1,6 +1,6 @@
--- ---
title: "end else pair" title: "end else pair"
tags: ["Readability"] tags: ["AL","Readability"]
categories: ["Best Practice"] categories: ["Best Practice"]
--- ---
@ -33,9 +33,3 @@ The `end else` pair should always appear on the same line.
... ...
end; end;
``` ```
## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=end+else/pair+category%3A%22BC+Best+Practices%22)
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices).
If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article.

View file

@ -0,0 +1,109 @@
---
title: "if not then exit"
tags: ["AL"]
categories: ["Best Practice"]
---
_Created by sirhc101, Described by sirhc101_
## Description
In general when we are working with tables we want to make sure, the filtered dataset includes records and does not result in a runtime error, so we use `if` to handle the result of `Find()`, `FindSet()`, `Get()`, etc.
This automatically causes on indent in source code and often the source code does not just contain one but two or more tables involved which leads to multi-level indentation.
Basically this is a result of bad coding structure but maybe sometimes necessary. On the other hand this causes multiple `end;` usages and leads to the usage of colorization and other helpers to see which `begin` belongs to which `end;`.
Instead of using `if (Record.FindSet()) then` to fetch records from a database it's good practice to use `if (not Record.FindSet()) then` following by an `exit();` to not further process the source code and make it clear for other developers where they can stop reading in certain cases.
Furthermore, this more or less automatically leads to smaller and better structured procedures and reduces the complexity of the source code.
## Bad code
```al
SalesHeader.Reset();
SalesHeader.SetRange("Document Type", SalesHeader."Document Type"::Order);
SalesHeader.SetRange(Status, SalesHeader.Status::Open);
if (SalesHeader.FindSet(false)) then begin
repeat
SalesLine.Reset();
SalesLine.SetRange("Document Type", SalesHeader."Document Type"::Order);
SalesLine.SetRange("Document No.", SalesHeader."No.");
if (SalesLine.FindSet(true)) then begin
repeat
DoSomething();
until SalesLine.Next() = 0;
end;
until SalesHeader.Next() = 0;
DoSomethingElse();
end;
```
or
```al
SalesLine.Reset();
SalesLine.SetRange("Document Type", SalesHeader."Document Type"::Order);
if (SalesLine.FindSet(true)) then begin
repeat
case SalesLine."Type" of
SalesLine."Type"::Item:
DoSomethingItem();
SalesLine."Type"::Resource:
DoSomethingResource();
end;
until SalesLine.Next() = 0;
end;
```
## Good code
```al
procedure DoSomethingSalesOrder()
var
SalesHeader: Record "Sales Header";
begin
SalesHeader.SetRange("Document Type", SalesHeader."Document Type"::Order);
SalesHeader.SetRange(Status, SalesHeader.Status::Open);
if (not SalesHeader.FindSet(false)) then
exit;
repeat
DoSomethingSalesLine(SalesHeader);
until SalesHeader.Next() = 0;
DoSomethingElse();
end;
procedure DoSomethingSalesLine(var SalesHeader: Record "Sales Header")
var
SalesLine: Record "Sales Line";
begin
SalesLine.Reset();
SalesLine.SetRange("Document Type", SalesHeader."Document Type"::Order);
SalesLine.SetRange("Document No.", SalesHeader."No.");
if (not SalesLine.FindSet(true)) then
exit;
repeat
DoSomething();
until SalesLine.Next() = 0;
end;
```
or
```al
SalesLine.SetRange("Document Type", SalesHeader."Document Type"::Order);
if (not SalesLine.FindSet(true)) then
exit;
repeat
case SalesLine."Type" of
SalesLine."Type"::Item:
DoSomethingItem();
SalesLine."Type"::Resource:
DoSomethingResource();
end;
until SalesLine.Next() = 0;
```

View file

@ -0,0 +1,60 @@
---
title: "IsTemporary record safeguard"
tags: ["AL"]
categories: ["Best Practice"]
---
_Created by Kine, Described by Kine_
## Description
When you are working with temporary tables or real tables, you can have code, where you assume that Record variable is or is not temporary. Best practice is to not assume, but test it to be sure. In history,
many developers went through painful period when they did unwanted "DeleteAll" over real table in production database, because they were only assuming something (mostly it happened only once to them).
Therefore it is good practice to use [Record.IsTemporary()](https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/record/record-istemporary-method) method to test this predicate, mainly when you are doing destructive action.
Another case when it is good practice to use this test is when you are subscribing to triggers on table. In most cases, you do not want to run your code when the trigger is running over temporary record. And you cannot assume, that
this specific table will not be used as temporary by someone else. Reacting to the trigger as if it was triggered by real table change could lead to corrupted data or unpredictable errors and the reason could be hard to find.
## Bad code
```al
ShouldBeTemporary.DeleteAll(true);
```
or
```al
[EventSubscriber(ObjectType::Table, Database::"Some Table", 'OnAfterInsertEvent', '', false, false)]
local procedure DoSomethingOnAfterInsertSomeTable(var Rec: Record "Some Table")
begin
DoSomething(Rec);
end;
```
## Good code
```al
if ShouldBeTemporary.IsTemporary() then
ShouldBeTemporary.DeleteAll(true);
```
or
```al
if not ShouldBeTemporary.IsTemporary() then
Error(RecNotTemporaryErr);
ShouldBeTemporary.DeleteAll(true);
```
or
```al
[EventSubscriber(ObjectType::Table, Database::"Some Table", 'OnAfterInsertEvent', '', false, false)]
local procedure DoSomethingOnAfterInsertSomeTable(var Rec: Record "Some Table")
begin
if Rec.IsTemporary() then
Exit;
DoSomething(Rec);
end;
```

View file

@ -0,0 +1,39 @@
---
title: "Keyboard Shortcuts"
tags: ["AL","Productivity"]
categories: ["Best Practice"]
---
_Created by Christian Lenz, Described by Christian Lenz_
## Description
To increase developer productivity while coding, use keyboard shortcuts that are available in the specific context to execute actions faster.
This is a selection of the community's favorites (more to come).
**Windows**
| What | Where | How |
|---|---|---|
| Delete word | Editor | CTRL + Backspace |
**VS Code**
| What | Where | How |
|---|---|---|
| Switch Tab | Editor | ALT + <Arrow Left/Right> |
| Move Line Up/Down | Editor | ALT + <Arrow Up/Down> |
| Copy Line Below/Above | Editor | ALT + SHIFT + <Arrow Up/Down> |
| Delete Line | Editor | CTRL + X (without selection) |
| Add Selection To Next Match | Editor | CTRL + D |
| Select All Occurences Of Find Match | Editor | CTRL + SHIFT + L |
| Add Cursors To Line Ends | Editor | SHIFT + ALT + I (after selecting lines) |
| Add Cursor Above/Below | Editor | CTRL + ALT + <Arrow Up/Down> |
| Place Multiple Cursors Manually | Editor | ALT + Click |
| Fast Scrolling | Editor | ALT + Mouse Wheel |
| Go To Symbol In File | Editor | CTRL + SHIFT + O |
| Breadcrumbs - Open And Select | Editor | CTRL + SHIFT + . |
| Go Back / Forward | Go To Definition | ALT + <Arrow Left/Right> |

View file

@ -1,12 +1,13 @@
--- ---
title: "Keyword Pairs - Indentation" title: "Keyword Pairs - Indentation"
tags: ["Readability"] tags: ["AL","Readability"]
categories: ["Best Practice"] categories: ["Best Practice"]
--- ---
_Created by Microsoft, Described by waldo_ _Created by Microsoft, Described by waldo_
## Description ## Description
The `if..then` pair, `while..do` pair, and `for..do` pair must appear on the same line or the same level of indentation. If possible, you can align the lines it is even much more readable. The `if..then` pair, `while..do` pair, and `for..do` pair must appear on the same line or the same level of indentation. If possible, you can align the lines it is even much more readable.
## Bad code ## Bad code
@ -23,9 +24,3 @@ The `if..then` pair, `while..do` pair, and `for..do` pair must appear on the sam
(a = b) (a = b)
then then
``` ```
## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=keyword+pair+indentation+category%3A%22BC+Best+Practices%22)
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices).
If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article.

View file

@ -1,11 +1,12 @@
--- ---
title: "Line Start Keywords" title: "Line Start Keywords"
tags: ["Readability"] tags: ["AL","Readability"]
categories: ["Best Practice"] categories: ["Best Practice"]
--- ---
<_Created by Microsoft, Described by waldo_\> _Created by Microsoft, Described by waldo_
## Description ## Description
The `end`, `if`, `repeat`, `for`, `while`, `else` and `case` statement should always start a line. The `end`, `if`, `repeat`, `for`, `while`, `else` and `case` statement should always start a line.
## Bad code ## Bad code
@ -28,10 +29,3 @@ The `end`, `if`, `repeat`, `for`, `while`, `else` and `case` statement should al
if IsSalesCycleCode then if IsSalesCycleCode then
ValidatSalesCycleCode(); ValidatSalesCycleCode();
``` ```
## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=line+start+keyword+category%3A%22BC+Best+Practices%22)
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices).
If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article.

View file

@ -1,12 +1,13 @@
--- ---
title: "Lonely Repeat" title: "Lonely Repeat"
tags: ["Readability"] tags: ["AL","Readability"]
categories: ["Best Practice"] categories: ["Best Practice"]
--- ---
_Created by Microsoft, Described by waldo_ _Created by Microsoft, Described by waldo_
## Description ## Description
The `repeat` statement should always be alone on a line. The `repeat` statement should always be alone on a line.
## Bad code ## Bad code
@ -21,9 +22,3 @@ The `repeat` statement should always be alone on a line.
if ReservEntry.FindSet() then if ReservEntry.FindSet() then
repeat repeat
``` ```
## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=lonely+repeat+category%3A%22BC+Best+Practices%22)
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices).
If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article.

View file

@ -1,12 +1,13 @@
--- ---
title: "Named Invocations" title: "Named Invocations"
tags: ["Readability"] tags: ["AL","Readability"]
categories: ["Best Practice"] categories: ["Best Practice"]
--- ---
_Created by Microsoft, Described by waldo_ _Created by Microsoft, Described by waldo_
## Description ## Description
When calling an object statically use the Object Name, not the Object Id. When calling an object statically use the Object Name, not the Object Id.
## Bad code ## Bad code
@ -21,8 +22,8 @@ When calling an object statically use the Object Name, not the Object Id.
Page.RunModal(Page::"Posted Sales Shipment Lines", SalesShptLine); Page.RunModal(Page::"Posted Sales Shipment Lines", SalesShptLine);
``` ```
## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=named+invocations+category%3A%22BC+Best+Practices%22) ## Tips
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). The [BusinessCentral.LinterCop](https://marketplace.visualstudio.com/items?itemName=StefanMaron.businesscentral-lintercop) extension adds a new rule to check your code for hardcoded object IDs.
If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article. - [LC0012](https://github.com/StefanMaron/BusinessCentral.LinterCop/wiki/LC0012): Using hardcoded IDs in functions like Codeunit.Run() is not allowed.

View file

@ -1,44 +1,41 @@
--- ---
title: "One Statement per Line" title: "One Statement per Line"
tags: ["Readability"] tags: ["AL","Readability"]
categories: ["Best Practice"] categories: ["Best Practice"]
--- ---
_Created by Microsoft, Described by waldo_ _Created by Microsoft, Described by waldo_
## Description ## Description
A line of code should not have more than one statement. A line of code should not have more than one statement.
## Bad code ## Example 1
### Bad code
```al ```al
if OppEntry.Find('-') then exit; if OppEntry.Find('-') then exit;
``` ```
### Good code
## Good code
```al ```al
if OppEntry.Find('-') then if OppEntry.Find('-') then
exit; exit;
``` ```
## Bad code ## Example 2
### Bad code
```al ```al
TotalCost += Cost; TotalAmt += Amt; TotalCost += Cost; TotalAmt += Amt;
``` ```
### Good code
## Good code
```al ```al
TotalCost += Cost; TotalCost += Cost;
TotalAmt += Amt; TotalAmt += Amt;
``` ```
## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=one+statement+per+line+category%3A%22BC+Best+Practices%22)
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices).
If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article.

View file

@ -1,18 +1,19 @@
--- ---
title: "Seperate if and else" title: "Seperate if and else"
tags: ["Readability"] tags: ["AL","Readability"]
categories: ["Best Practice"] categories: ["Best Practice"]
--- ---
_Created by Microsoft, Described by waldo_ _Created by Microsoft, Described by waldo_
## Description ## Description
`if` and `else` statements should be on separate lines. `if` and `else` statements should be on separate lines.
## Bad code ## Bad code
```al ```al
if Atom = '\>' then HasLogicalOperator := true else begin if Atom = '>' then HasLogicalOperator := true else begin
... ...
end; end;
``` ```
@ -20,16 +21,9 @@ _Created by Microsoft, Described by waldo_
## Good code ## Good code
```al ```al
if Atom = '\>' then if Atom = '>' then
HasLogicalOperator := true HasLogicalOperator := true
else begin else begin
... ...
end; end;
``` ```
## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=separate+if+and+else+category%3A%22BC+Best+Practices%22)
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices).
If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article.

View file

@ -1,45 +1,52 @@
--- ---
title: "Spacing Binary Operators" title: "Spacing Binary Operators"
tags: ["Readability"] tags: ["AL","Readability"]
categories: ["Best Practice"] categories: ["Best Practice"]
--- ---
_Created by Microsoft, Described by waldo_ _Created by Microsoft, Described by waldo_
## Description ## Description
There must be exactly one space character on each side of a binary operator such as = + - AND OR =. The parameter comma operator however, should have a space after the comma. There must be exactly one space character on each side of a binary operator such as = + - AND OR =. The parameter comma operator however, should have a space after the comma.
## Bad code ## Example 1
### Bad code
```al ```al
"Line Discount %" := "Line Discount Amount"/"Line Value"*100; "Line Discount %" := "Line Discount Amount"/"Line Value"*100;
``` ```
## Good code ### Good code
```al ```al
"Line Discount %" := "Line Discount Amount" / "Line Value" * 100; "Line Discount %" := "Line Discount Amount" / "Line Value" * 100;
``` ```
## Bad code ## Example 2
### Bad code
```al ```al
StartDate := CalcDate('<+'+Format(Days+i)+'D\>',StartDate); StartDate := CalcDate('<+'+Format(Days+i)+'D\>',StartDate);
``` ```
## Good code ### Good code
```al ```al
StartDate := CalcDate('<+' + Format(Days + i) + 'D\>', StartDate); StartDate := CalcDate('<+' + Format(Days + i) + 'D\>', StartDate);
``` ```
## Bad code ## Example 3
### Bad code
```al ```al
StartDate:=0D; // Initialize StartDate:=0D; // Initialize
``` ```
## Good code ### Good code
```al ```al
StartDate := 0D; // Initialize StartDate := 0D; // Initialize

View file

@ -1,6 +1,6 @@
--- ---
title: "Suggested Abbreviations" title: "Suggested Abbreviations"
tags: ["Readability"] tags: ["AL","Readability"]
categories: ["Best Practice"] categories: ["Best Practice"]
--- ---
@ -359,9 +359,3 @@ If there is no other choice, then use the suggestions below.
| % | Pct | | % | Pct |
| 3-tier | Three-Tier | | 3-tier | Three-Tier |
| Outlook Synch | Osynch | | Outlook Synch | Osynch |
## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=abbreviations+category%3A%22BC+Best+Practices%22)
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices).
If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article.

View file

@ -1,6 +1,6 @@
--- ---
title: "Unnecessary else" title: "Unnecessary else"
tags: ["Readability"] tags: ["AL","Readability"]
categories: ["Best Practice"] categories: ["Best Practice"]
--- ---
@ -32,9 +32,3 @@ _Created by Microsoft, Described by waldo_
Error(BinCodeChangeNotAllowedErr, ...); Error(BinCodeChangeNotAllowedErr, ...);
end; end;
``` ```
## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=unnecessary+else+category%3A%22BC+Best+Practices%22)
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices).
If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article.

View file

@ -1,6 +1,6 @@
--- ---
title: "Unnecessary true/false" title: "Unnecessary true/false"
tags: ["Readability"] tags: ["AL","Readability"]
categories: ["Best Practice"] categories: ["Best Practice"]
--- ---
@ -9,33 +9,30 @@ _Created by Microsoft, Described by waldo_
## Description ## Description
Do not use `true` or `false` keywords unnecessarily if the expression is already an logical expression. Do not use `true` or `false` keywords unnecessarily if the expression is already an logical expression.
## Bad code ## Example 1
### Bad code
```al ```al
if IsPositive() = true then if IsPositive() = true then
``` ```
## Good code ### Good code
```al ```al
if IsPositive() then if IsPositive() then
``` ```
## Example 2
## Bad code ### Bad code
```al ```al
if Complete <> true then if Complete <> true then
``` ```
## Good code ### Good code
```al ```al
if not Complete then if not Complete then
``` ```
## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=unnecessary+true+false+category%3A%22BC+Best+Practices%22)
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices).
If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article.

View file

@ -1,12 +1,13 @@
--- ---
title: "Variable Naming" title: "Variable Naming"
tags: ["Readability"] tags: ["AL","Readability"]
categories: ["Best Practice"] categories: ["Best Practice"]
--- ---
_Created by Microsoft, Described by waldo_ _Created by Microsoft, Described by waldo_
## Description ## Description
Variables that refer to a AL object must contain the objects name, abbreviated where necessary. Variables that refer to a AL object must contain the objects name, abbreviated where necessary.
A variable must begin with a capital letter. A variable must begin with a capital letter.
@ -15,34 +16,48 @@ Blanks, periods, and other characters (such as parentheses) that would make quot
If a variable is a compound of two or more words or abbreviations, each word or abbreviation should begin with a capital letter. If a variable is a compound of two or more words or abbreviations, each word or abbreviation should begin with a capital letter.
## Bad code ## Example 1
### Bad code
```al ```al
WIPBuffer: Record "Job WIP Buffer" WIPBuffer: Record "Job WIP Buffer"
``` ```
## Good code
### Good code
```al ```al
JobWIPBuffer: Record "Job WIP Buffer" JobWIPBuffer: Record "Job WIP Buffer"
``` ```
## Bad code
## Example 2
### Bad code
```al ```al
Postline: Codeunit "Gen. Jnl.-Post Line"; Postline: Codeunit "Gen. Jnl.-Post Line";
``` ```
## Good code
### Good code
```al ```al
GenJnlPostLine: Codeunit "Gen. Jnl.-Post Line"; GenJnlPostLine: Codeunit "Gen. Jnl.-Post Line";
``` ```
## Bad code
## Example 3
### Bad code
```al ```al
"Amount (LCY)": Decimal; "Amount (LCY)": Decimal;
``` ```
## Good code
### Good code
```al ```al
AmountLCY: Decimal; AmountLCY: Decimal;
``` ```
## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=one+variable+naming+category%3A%22BC+Best+Practices%22) ## Tips
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). The [AL Variable Helper](https://marketplace.visualstudio.com/items?itemName=rasmus.al-var-helper) extension provides Intellisense support to assign correct variable names in AL.
If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article.

View file

@ -1,12 +1,13 @@
--- ---
title: "Variables Declarations Order" title: "Variables Declarations Order"
tags: ["Readability"] tags: ["AL","Readability"]
categories: ["Best Practice"] categories: ["Best Practice"]
--- ---
_Created by Microsoft, Described by waldo_ _Created by Microsoft, Described by waldo_
## Description ## Description
Variables declarations should be ordered by type. In general, object and complex variable types are listed first followed by simple variables. The order should be: Variables declarations should be ordered by type. In general, object and complex variable types are listed first followed by simple variables. The order should be:
- Record - Record
@ -25,7 +26,6 @@ Variables declarations should be ordered by type. In general, object and complex
(Ref: [Microsoft Docs](https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/analyzers/codecop-aa0021)) (Ref: [Microsoft Docs](https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/analyzers/codecop-aa0021))
## Bad code ## Bad code
```al ```al
@ -40,8 +40,9 @@ Variables declarations should be ordered by type. In general, object and complex
StartingDateFilter: Text; StartingDateFilter: Text;
``` ```
## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=one+variables+declarations+order+category%3A%22BC+Best+Practices%22) ## Tips
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). The [AZ AL Dev Tools/AL Code Outline](https://marketplace.visualstudio.com/items?itemName=andrzejzwierzchowski.al-code-outline) extension adds two new commands to Visual Studio Code to sorts variables.
If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article. - `Sort Variables in the Active Editor` : sorts variables in the current editor
- `Sort Variables in the Active Project` : sorts variables in the current project

View file

@ -38,6 +38,66 @@ Results in:
end; end;
``` ```
## Diagrams with Mermaid
When providing a documentation, diagrams come in handy. [Mermaid](https://mermaid-js.github.io/mermaid/#/) lets you create diagrams and visualizations using text and code.
For example the following markdown section:
````
```mermaid
classDiagram
Animal <|-- Duck
Animal <|-- Fish
Animal <|-- Zebra
Animal : +int age
Animal : +String gender
Animal: +isMammal()
Animal: +mate()
class Duck{
+String beakColor
+swim()
+quack()
}
class Fish{
-int sizeInFeet
-canEat()
}
class Zebra{
+bool is_wild
+run()
}
```
````
Results in:
```mermaid
classDiagram
Animal <|-- Duck
Animal <|-- Fish
Animal <|-- Zebra
Animal : +int age
Animal : +String gender
Animal: +isMammal()
Animal: +mate()
class Duck{
+String beakColor
+swim()
+quack()
}
class Fish{
-int sizeInFeet
-canEat()
}
class Zebra{
+bool is_wild
+run()
}
```
Can't wait to get started? Use the Mermaid [Live Editor](https://mermaid.live/edit).
## Hugo Shortcodes ## Hugo Shortcodes
Since we're using "Hugo", we can use it's shortcode. Here is a reference: [https://gohugo.io/content-management/shortcodes/](https://gohugo.io/content-management/shortcodes/) Since we're using "Hugo", we can use it's shortcode. Here is a reference: [https://gohugo.io/content-management/shortcodes/](https://gohugo.io/content-management/shortcodes/)

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View file

@ -0,0 +1,57 @@
---
title: "Manually on Windows 11"
---
This guide will walk You thrugh installing Hugo on a Windows 11 PC. For the official install guide, You can wisit <https://gohugo.io/gettingstarted/installing/>.
## Download Binaries
The path of least resistance is to just download the .zip file from the official Hugo GitHub Repository [here](https://github.com/gohugoio/hugo/releases).
The theme that are used, needs the extended version of Hugo, so make sure to download the **extended** version by ensuring the file name starts with `hugo_extended...`
{{% alert title="info" color="info" %}}
For the purpose of this install guide, we are assuming You will want to follow the "standard" used by Hugo for installing. We will be creating a `Hugo` folder in the root of `C:\`. That folder will have a `Bin` folder for the binaries, and a `Sites` folder for each website You are building.
Once You are done, You should have a folder structure that looks like this:
```text
C:\Hugo
├── Bin # Binaries
└┬─ Sites # Hugo Site Repositories
└── alguidelines # Hugo Source for alguidelines.dev
```
{{% /alert %}}
![image](SelectExtended.png)
After downloading the .zip file, extract the zip-file to `c:\Hugo\Bin`
![image](Extract.png)
![image](ExtractToBin.png)
## Add Hugo to Path
After copying the binaries to Your PC, You will need to add Hugo binaries to the `%PATH%` system environment variables.
To do that, search for `environment`
![image](SearchForEnv.png)
once you see the `Edit the system environment variables`, open it and select `Environment Variables`
![image](SystemProperties.png)
Once the Environment Variables screen is open, highlight the `Path` lines and press the `Edit...` button
![image](EnvironmentVariables.png)
Now press `New` and add the `C:\Hugo\Bin` to the path. Press `OK` and `OK` to save the new `Path`
![image](EnvironmentVariablesPath.png)
Once complete. You should now be able to preview the Hugo site on <http://localhost:1313> by opening a command promt, and open the `C:\Hugo\Sites\alguidelines` folder and execute `Hugo Serve`
![image](HugoServe.png)

View file

@ -0,0 +1,35 @@
---
Title: Devcontainer with VS Code
---
## Use a local devcontainer
If you don't want any local setup (apart from Docker Desktop), but still run your own Hugo instance, you can make use of the preconfigured devcontainer. If you want to learn more about the concept, visit [https://code.visualstudio.com/docs/remote/containers](https://code.visualstudio.com/docs/remote/containers). To use it, you need to take the following steps:
1. Start [Docker Desktop](https://www.docker.com/products/docker-desktop) and [switch to Linux containers](https://docs.docker.com/desktop/windows/#switch-between-windows-and-linux-containers) by right-clicking on the Docker logo in the system tray and selecting "Switch to Linux containers...". If you only see "Switch to Windows containers...", then you are already switched to Linux containers. If anything goes wrong, check if you are on the latest version of Docker Desktop and have [the WSL2 integration enabled](https://docs.docker.com/desktop/windows/wsl/#install). If you have all that in place and it still doesn't work, check the extended installation documentation [here](https://code.visualstudio.com/docs/remote/containers#_installation)
{{% alert title="Consequences of switching" color="info" %}}
When switching to Linux, you will probably see a warning that tells you that you "will not be able to manage the Windows containers until you switch back to Windows containers". That means that the Docker Desktop management GUI can only show either the Windows containers or the Linux containers and if you switch to Linux, you consequently won't see the Windows containers until you switch back. But the Windows containers will continue to run, you won't loose data and you can keep using them e.g. for Business Central development, you just can't manage them through the Docker Desktop GUI
{{% /alert %}}
2. Install the [Remote development extension pack](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack) in Visual Studio Code
3. Run the action "Remote containers: Clone Repository in Container Volume" and select the fork you created. If you haven't done that before, go through the [docs](https://alguidelines.dev/docs/contributing/forkandpr/#step-1-fork).
4. Wait for a bit. When you do this for the first time, it can take a couple of minutes. Next time it will be faster...
5. After a while, you will have VS Code with the cloned repository and the terminal should show something like "Done. Press any key to close the terminal."
6. Run the action "Tasks: Run task" and select "Start local Hugo Server" from the list. If you don't see that entry, you might have to reload your VS Code window and try again
7. After Hugo has generated the site, you will get a notification that offers you to "Open a browser". Click on that and you will see your local instance of the AL guidelines! Again, on the first try it will be a bit slow and sluggish, but the second one should be fast.
8. Now you can make changes and just save them. If you open the terminal, you will see a message that tells you that a change was detected and the site was rebuilt. After that, the change should automatically appear in your browser
Here is a walkthrough of the full process:
<video width=100% controls>
<source src="alguidelines walkthrough.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
## Use GitHub Codespaces
What is also great about this, is that you can also use [GitHub Codespaces](https://github.com/features/codespaces) with that setup. In that case, steps 1-5 become two clicks... Here is another full walkthrough:
<video width=100% controls>
<source src="alguidelines codespace.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>

View file

@ -0,0 +1,22 @@
---
Title: Powershell on Windows 11
description: >
Install Hugo with a simple Powershell Script and chocolatey
---
It is possible to use a powershell script and Chocolatey to install and other dependencies. Execute the following script:
```powershell
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
choco install -y nodejs
choco install -y hugo-extended
```
Once complete, in root of of the repository execute the following commands
```powershell
git submodule update --init --recursive --depth 1
npm install
```

View file

@ -0,0 +1,9 @@
---
title: Install Hugo
---
There are multiple ways to install Hugo for you to properly preview your contributions. Please select the scenario that matches your setup.
For the official install guide, you can visit <https://gohugo.io/gettingstarted/installing/>
{{< youtube G7umPCU-8xc >}}

View file

@ -1,6 +1,6 @@
--- ---
title: "Title Here" title: "Title Here"
tags: [] tags: ["AL"]
categories: ["Best Practice"] categories: ["Best Practice"]
--- ---
@ -29,11 +29,3 @@ PutCodeblocksHere()
```al ```al
PutCodeblocksHere() PutCodeblocksHere()
``` ```
## Discussions
Please discuss this guideline <!--[here](https://github.com/microsoft/alguidelines/discussions/42) Fix the link -->
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices).
<!-- Create a discussions-page of your pattern, and add the sentence "You can discuss this pattern [here](https://github.com/microsoft/alguidelines/discussions/42)" with the right link to that discussions-page. -->

View file

@ -1,6 +1,6 @@
--- ---
title: "Pattern Name" title: "Title Here"
tags: [] tags: ["AL"]
categories: ["Pattern"] categories: ["Pattern"]
--- ---
@ -44,11 +44,3 @@ Usually, there are occasions where NOT to implement the pattern. List the disad
## List of references ## List of references
Youtube-link? BaseApp? Tweet? ... Youtube-link? BaseApp? Tweet? ...
## Discussions
Please discuss this guideline <!--[here](https://github.com/microsoft/alguidelines/discussions/42) Fix the link -->
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-patterns).
<!-- Create a discussions-page of your pattern, and add the sentence "You can discuss this pattern [here](https://github.com/microsoft/alguidelines/discussions/42)" with the right link to that discussions-page. -->

View file

@ -2,6 +2,7 @@
chapter = true chapter = true
title = "2. Anti-Patterns" title = "2. Anti-Patterns"
weight = 130 weight = 130
tags = ["C/AL"]
+++ +++
Some of the software development practices, had **not** stood the test of time. Despite that, some are still being used today by developers everywhere. Some of the software development practices, had **not** stood the test of time. Despite that, some are still being used today by developers everywhere.

View file

@ -1,6 +1,7 @@
+++ +++
title = "Nav Upgrade" title = "Nav Upgrade"
weight = 840 weight = 840
tags = ["C/AL"]
+++ +++
## Anti-Patterns in NAV Upgrade ## Anti-Patterns in NAV Upgrade

View file

@ -1,6 +1,7 @@
+++ +++
title = "Reusable Bugs" title = "Reusable Bugs"
weight = 1020 weight = 1020
tags = ["C/AL"]
+++ +++
_By Bogdana Botez, Andreas Moth, Eric Wauters (waldo), Elly Nkya, Nikola Kukrika_ _By Bogdana Botez, Andreas Moth, Eric Wauters (waldo), Elly Nkya, Nikola Kukrika_

View file

@ -2,6 +2,8 @@
chapter = true chapter = true
title = "3. CAL Coding Guidelines" title = "3. CAL Coding Guidelines"
weight = 150 weight = 150
tags = ["C/AL"]
categories = ["Best Practice"]
+++ +++
We've decided to publish our current C/AL coding guidelines. They are actual, as per January 2015 when this is published (but might fall out of sync as time goes by). We've decided to publish our current C/AL coding guidelines. They are actual, as per January 2015 when this is published (but might fall out of sync as time goes by).
@ -21,6 +23,6 @@ We're looking forward to your comments. Where you can, do provide concrete examp
[anchor0]: https://blogs.msdn.microsoft.com/nav/2015/01/09/cal-coding-guidelines-used-at-microsoft-development-center-copenhagen "download the C/AL coding guidelines as pdf" [anchor0]: /files/CAL-Coding-Guidelines-at-Microsoft-Development-Center-Copenhagen.pdf "download the C/AL coding guidelines as pdf"
[anchor1]: /members/waldo/default.aspx "waldo" [anchor1]: /members/waldo/default.aspx "waldo"
[anchor2]: https://www.youtube.com/watch?v=z6skKy0pkmU&list=PLhZ3P-LY7CqmVszuvtJLujFyHpsVN0U_w&index=26 [anchor2]: https://www.youtube.com/watch?v=z6skKy0pkmU&list=PLhZ3P-LY7CqmVszuvtJLujFyHpsVN0U_w&index=26

View file

@ -1,6 +1,8 @@
+++ +++
title = "Design" title = "Design"
weight = 490 weight = 490
tags = ["C/AL"]
categories = ["Best Practice"]
+++ +++
## C/AL Coding Guidelines ## C/AL Coding Guidelines

View file

@ -1,6 +1,8 @@
+++ +++
title = "By Reference Parameters" title = "By Reference Parameters"
weight = 280 weight = 280
tags = ["C/AL"]
categories = ["Best Practice"]
+++ +++
Do not declare parameters by reference if their values are not intended to be changed. Do not declare parameters by reference if their values are not intended to be changed.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Class Coupling" title = "Class Coupling"
weight = 320 weight = 320
tags = ["C/AL"]
categories = ["Best Practice"]
+++ +++
Do not write functions that have high class coupling. This makes the code hard to maintain. Do not write functions that have high class coupling. This makes the code hard to maintain.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Cyclomatic Complexity" title = "Cyclomatic Complexity"
weight = 460 weight = 460
tags = ["C/AL"]
categories = ["Best Practice"]
+++ +++
Do not write functions that have high cyclomatic complexity. This makes the code hard to maintain. Do not write functions that have high cyclomatic complexity. This makes the code hard to maintain.

View file

@ -1,5 +1,7 @@
+++ +++
title = "Encapsulate Local Functionality" title = "Encapsulate Local Functionality"
weight = 530 weight = 530
tags = ["C/AL"]
categories = ["Best Practice"]
+++ +++
Any function used local must be defined as local. Any function used local must be defined as local.

View file

@ -1,6 +1,8 @@
+++ +++
title = "FINDSET FINDFIRST FINDLAST" title = "FINDSET FINDFIRST FINDLAST"
weight = 600 weight = 600
tags = ["C/AL"]
categories = ["Best Practice"]
+++ +++
FINDSET, FIND('+') or FIND('-') should only be used when NEXT is used and vice versa. FINDSET, FIND('+') or FIND('-') should only be used when NEXT is used and vice versa.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Initialized Variables" title = "Initialized Variables"
weight = 660 weight = 660
tags = ["C/AL"]
categories = ["Best Practice"]
+++ +++
Variables should always be set to a specific value, before they are used. Variables should always be set to a specific value, before they are used.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Maintainability Index" title = "Maintainability Index"
weight = 770 weight = 770
tags = ["C/AL"]
categories = ["Best Practice"]
+++ +++
[Maintainability Index][anchor0]: Do not write functions that have a very low maintainability index. This makes the code hard to maintain. [Maintainability Index][anchor0]: Do not write functions that have a very low maintainability index. This makes the code hard to maintain.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Parameter Placeholders" title = "Parameter Placeholders"
weight = 920 weight = 920
tags = ["C/AL"]
categories = ["Best Practice"]
+++ +++
The number of parameters passed to a string must match the placeholders. The number of parameters passed to a string must match the placeholders.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Static Object Invocation" title = "Static Object Invocation"
weight = 1160 weight = 1160
tags = ["C/AL"]
categories = ["Best Practice"]
+++ +++
Call objects statically whenever possible. It reduces extra noise and removes extra variables. Downside: changing the name of the object which is called statically will need a code update. Call objects statically whenever possible. It reduces extra noise and removes extra variables. Downside: changing the name of the object which is called statically will need a code update.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Unreachable Code" title = "Unreachable Code"
weight = 1310 weight = 1310
tags = ["C/AL"]
categories = ["Best Practice"]
+++ +++
Do not write code that will never be hit. Do not write code that will never be hit.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Unused Initialized Variables" title = "Unused Initialized Variables"
weight = 1320 weight = 1320
tags = ["C/AL"]
categories = ["Best Practice"]
+++ +++
The value assigned to a variable must be used. Else the variable is not necessary. The value assigned to a variable must be used. Else the variable is not necessary.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Unused Variables" title = "Unused Variables"
weight = 1330 weight = 1330
tags = ["C/AL"]
categories = ["Best Practice"]
+++ +++
Do not declare variables that are unused. Do not declare variables that are unused.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Variable Capacity Mismatch" title = "Variable Capacity Mismatch"
weight = 1410 weight = 1410
tags = ["C/AL"]
categories = ["Best Practice"]
+++ +++
Do not assign a value to a variable whose capacity is smaller. Do not assign a value to a variable whose capacity is smaller.

View file

@ -1,6 +1,8 @@
+++ +++
title = "WITH Scope Name Collision" title = "WITH Scope Name Collision"
weight = 1450 weight = 1450
tags = ["C/AL"]
categories = ["Best Practice"]
+++ +++
Do not use the WITH scope when it has a variable whose name is the same as a local variable. This can lead to wrong code assumptions. Do not use the WITH scope when it has a variable whose name is the same as a local variable. This can lead to wrong code assumptions.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Internally used DotNet Types" title = "Internally used DotNet Types"
weight = 690 weight = 690
tags = ["C/AL"]
categories = ["Best Practice"]
+++ +++
_(Dynamics NAV 2015)_ _(Dynamics NAV 2015)_

View file

@ -1,6 +1,8 @@
+++ +++
title = "Internationalization" title = "Internationalization"
weight = 700 weight = 700
tags = ["C/AL"]
categories = ["Best Practice"]
+++ +++
## C/AL Coding Guidelines ## C/AL Coding Guidelines

View file

@ -1,6 +1,8 @@
+++ +++
title = "Using Calcdate" title = "Using Calcdate"
weight = 1370 weight = 1370
tags = ["C/AL"]
categories = ["Best Practice"]
+++ +++
CALCDATE should only be used with DateFormula variables. Alternatively the string should be enclosed using the <> symbols. CALCDATE should only be used with DateFormula variables. Alternatively the string should be enclosed using the <> symbols.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Localizability" title = "Localizability"
weight = 750 weight = 750
tags = ["C/AL"]
categories = ["Best Practice"]
+++ +++
## C/AL Coding Guidelines ## C/AL Coding Guidelines

View file

@ -1,6 +1,8 @@
+++ +++
title = "CaptionML on System Pages" title = "CaptionML on System Pages"
weight = 300 weight = 300
tags = ["C/AL"]
categories = ["Best Practice"]
+++ +++
CaptionML should always be specified on a page field for a system table. By default, system tables do not have captions, so if you need to use them in the UI then captions need to be added. CaptionML should always be specified on a page field for a system table. By default, system tables do not have captions, so if you need to use them in the UI then captions need to be added.

View file

@ -1,6 +1,8 @@
+++ +++
title = "FIELDCAPTION and TABLECAPTION" title = "FIELDCAPTION and TABLECAPTION"
weight = 580 weight = 580
tags = ["C/AL"]
categories = ["Best Practice"]
+++ +++
For user messages, errors etc., use FIELDCAPTION not FIELDNAME and TABLECAPTION not TABLENAME. For user messages, errors etc., use FIELDCAPTION not FIELDNAME and TABLECAPTION not TABLENAME.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Global Text Constants" title = "Global Text Constants"
weight = 610 weight = 610
tags = ["C/AL"]
categories = ["Best Practice"]
+++ +++
Declare Text Constant as global variables. Declare Text Constant as global variables.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Use Text Constants" title = "Use Text Constants"
weight = 1360 weight = 1360
tags = ["C/AL"]
categories = ["Best Practice"]
+++ +++
Pass user messages using Text Constants. It makes translation easy. Pass user messages using Text Constants. It makes translation easy.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Using OptionCaptionML" title = "Using OptionCaptionML"
weight = 1380 weight = 1380
tags = ["C/AL"]
categories = ["Best Practice"]
+++ +++
The OptionCaptionML should be filled in for sourceexpression using option data types. The OptionCaptionML should be filled in for sourceexpression using option data types.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Readability" title = "Readability"
weight = 980 weight = 980
tags = ["C/AL","Readability"]
categories = ["Best Practice"]
+++ +++
## C/AL Coding Guidelines ## C/AL Coding Guidelines

View file

@ -1,6 +1,8 @@
+++ +++
title = "Begin as an 'After Word'" title = "Begin as an 'After Word'"
weight = 230 weight = 230
tags = ["C/AL","Readability"]
categories = ["Best Practice"]
+++ +++
When BEGIN follows THEN, ELSE, DO, it should be on the same line, preceded by one space character. When BEGIN follows THEN, ELSE, DO, it should be on the same line, preceded by one space character.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Begin-End - Compound Only" title = "Begin-End - Compound Only"
weight = 240 weight = 240
tags = ["C/AL","Readability"]
categories = ["Best Practice"]
+++ +++
Only use BEGIN..END to enclose compound statements. Only use BEGIN..END to enclose compound statements.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Binary Operator to Start Line" title = "Binary Operator to Start Line"
weight = 250 weight = 250
tags = ["C/AL","Readability"]
categories = ["Best Practice"]
+++ +++
Do not start a line with a binary operator. Do not start a line with a binary operator.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Blank Lines" title = "Blank Lines"
weight = 260 weight = 260
tags = ["C/AL","Readability"]
categories = ["Best Practice"]
+++ +++
Do not use blank lines at the beginning or end of any functions, after BEGIN, before END, or inside multiline expressions. Do not use blank lines at the beginning or end of any functions, after BEGIN, before END, or inside multiline expressions.

View file

@ -1,6 +1,8 @@
+++ +++
title = "CASE Action" title = "CASE Action"
weight = 310 weight = 310
tags = ["C/AL","Readability"]
categories = ["Best Practice"]
+++ +++
A CASE action should start on a line after the possibility. A CASE action should start on a line after the possibility.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Colon usage in CASE" title = "Colon usage in CASE"
weight = 340 weight = 340
tags = ["C/AL","Readability"]
categories = ["Best Practice"]
+++ +++
The last possibility on a CASE statement must be immediately followed by a colon. The last possibility on a CASE statement must be immediately followed by a colon.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Comments inside Curly Brackets" title = "Comments inside Curly Brackets"
weight = 350 weight = 350
tags = ["C/AL","Readability"]
categories = ["Best Practice"]
+++ +++
Never use curly bracket comments. During development, the "Block comment" functionality can be used instead. However, in production code, block comments are not recommended. Never use curly bracket comments. During development, the "Block comment" functionality can be used instead. However, in production code, block comments are not recommended.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Comment Spacing" title = "Comment Spacing"
weight = 360 weight = 360
tags = ["C/AL","Readability"]
categories = ["Best Practice"]
+++ +++
Always start comments with // followed by one space character. Always start comments with // followed by one space character.

View file

@ -1,6 +1,8 @@
+++ +++
title = "END ELSE Pair" title = "END ELSE Pair"
weight = 540 weight = 540
tags = ["C/AL","Readability"]
categories = ["Best Practice"]
+++ +++
The END ELSE pair should always appear on the same line. The END ELSE pair should always appear on the same line.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Indentation" title = "Indentation"
weight = 650 weight = 650
tags = ["C/AL","Readability"]
categories = ["Best Practice"]
+++ +++
In general, use an indentation of two space characters. Logical expressions in the IF, WHILE, and UNTIL parts are indented at least 3, 6, and 6 spaces respectively. In general, use an indentation of two space characters. Logical expressions in the IF, WHILE, and UNTIL parts are indented at least 3, 6, and 6 spaces respectively.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Keyword Pairs - Indentation" title = "Keyword Pairs - Indentation"
weight = 730 weight = 730
tags = ["C/AL","Readability"]
categories = ["Best Practice"]
+++ +++
The IF..THEN pair, WHILE..DO pair, and FOR..DO pair must appear on the same line or the same level of indentation. The IF..THEN pair, WHILE..DO pair, and FOR..DO pair must appear on the same line or the same level of indentation.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Line Start Keywords" title = "Line Start Keywords"
weight = 740 weight = 740
tags = ["C/AL","Readability"]
categories = ["Best Practice"]
+++ +++
The END, IF, REPEAT, FOR, WHILE, ELSE and CASE statement should always start a line. The END, IF, REPEAT, FOR, WHILE, ELSE and CASE statement should always start a line.

View file

@ -1,6 +1,8 @@
+++ +++
title = "Lonely Repeat" title = "Lonely Repeat"
weight = 760 weight = 760
tags = ["C/AL","Readability"]
categories = ["Best Practice"]
+++ +++
The REPEAT statement should always be alone on a line. The REPEAT statement should always be alone on a line.

Some files were not shown because too many files have changed in this diff Show more