How to add XML comments in AL Code :- Business Central

With the release of Business Central Wave 1 2020 XML comments is available in AL code.

If you would like to add documentation to your code then you can use XML documentation .The documentation comment must immediately before the object such as codeunit,table,functions etc.

The syntax for adding XML comments in your code is triple slashes /// followed by one of the supported XML tags. There is IntelliSense support for writing documentation comments. Most importantly providing a template documentation comment when writing the third slash in the triple slash.

These documentation comments are visible when hovering over source symbols.

Advantage :

  1. XML document comment will improve readability ,add useful information about the code implementation and help others take over your code .
  2. With XML comments it also enable intellisense in AL objects that you add in your code as a help to other developers who is going extend your code.

Let sees an example how we can add the xml comments.

Created one simple code unit where we can add documentation comments.

Please note that If you have the showMyCode setting in the app.json file set to false and download an app package; the app package will not contain any XML comments.

Hope this will help you.