MyRapidi
MyRapidi

Search our Wiki

How to create an extension in Business Central / Publish SystemCreatedAt field in Business Central

SystemCreatedAt is one of the Data Audit Fields and is available on all tables but, for integration-purposes, you cannot access it via an ODATA connection because it needs to be published first. By inspecting the page, you can see this field and its corresponding value. In order to use this field in the production environment ( for integration purposes), you need to publish it by creating an extension in Visual Code via the AL Language extension for Microsoft Dynamics 365 Business Central.
















Before you start, an easy way to obtain all the needed information is to get all the extension information from your sandbox environment. In any sandbox environment, you can publish any field and download the AL extension file. This .al file can be used to be uploaded into production. 

Sign up for Business Central Sandbox and download the Visual Studio Code and the AL extension for Business Central. All steps are highlighted here.

  • Open any page in your Business Central Sandbox environment and then go to Settings -> Design.
















  • Click on + Field and select the field that you need to add to your page.







  • Drag and drop the selected field on the page where you want it to be displayed. 
  • Next, Click on Stop Designing and you will be asked to add the Extension Name for your extension and the Publisher ( the person who is actually creating it).Then, check the box for Download Code and click on Save.










  • The AL package containing the extension code will be downloaded on your computer and will contain 2 files: app.json and the pageExtension.al. Now, this page will show the Created At field for all customers and can be used moving forward.









  • Go to Visual Studio Code and simply copy-paste the files that you just downloaded from Business Central sandbox as follows: View -> Command Palette -> AL:Go!















  • You will be prompted to set up a new project and the default name will be suggested but you can change it accordingly. Then press Enter to confirm.
  • Next, you will be asked to select the target platform. Note: For Business Central cloud, it’s recommended to use the latest version from the list. 
  • Next, you will be asked to select the server. For cloud Business Central, you need to select Microsoft cloud sandbox
  • Into the HelloWorld.al copy-paste the content from the .al file that you downloaded earlier.And into app.json copy-paste the content from the downloaded file called app.json. 





















Note: if you need to publish this field on several pages, you would need to add each page extension one by one and indicate the page extension number, the page where you want the field to be published and the position of that specific field. 

































Important

  1. Make sure that you select the correct ID ranges for your extension. Once you indicate which would be your specific range, those IDs will be reserved for page extensions. And check that your launch.json contains the correct sandbox connection ( such as the environment name,etc). 
  2. Platform should be set up to 1.0.0.0 ;
  3. Remove the below section :

"build": {
    "timestamp": "2024-09-25T11:04:33.6766445+00:00",
    "compilerVersion": "13.1.17.29211"
  }

  • Once you are done with the above, click on View -> Command Palette -> AL: Package so you can compile everything. Afterwards, you will get the message 'Success:The package is created' and the package will be available for you under AL/ALProject folder.









  • Install the extension into the production environment: Go to Settings -> Advanced Settings
  • Click on Extensions
  • Click on Manage -> Upload Extension.
  • Click on Select .app file and upload the extension from your folder ( it’s the file with the .app extension that was generated after you’ve compiled everything in Visual Code) and then click on Deploy.

























  • Once the status shows Completed, then the installation has been successfully completed, you will be able to see the SystemCreatedAt field displayed on your page.