Skip to main content

How to Convert Objects from C/AL to AL ?

 

How to Convert Objects from C/AL to AL ?

The Txt2Al conversion tool allows you to take C/AL objects, which were created in Dynamics NAV or Business Central Spring 2019 (version 14), and convert them into the new .al format. 

  1. Exporting the objects from C/SIDE in a cleaned .txt format.
  2. Converting the objects to the new syntax. 
Here, I will be using BC14 (Business Central Spring 2019) Objects and will be converting Sales Credit Memo report from C/Al to AL. 

The .al format is used when developing extensions for Dynamics 365 Business Central.

 Converting the objects consists of following two steps:

Exporting the objects from C/SIDE in a cleaned .txt format

We need to run the Dynamics BC14 Development Shell as administrator to export BC14 object in new syntax.

Run the following command to export object in text file.

Syntax

Export-NAVApplicationObject   [-DatabaseName] <String>  [-Path] <String> [-DatabaseServer <String>] [-Filter <String>] [-ExportToNewSyntax]

To know more about this command  Export-NAVApplicationObject

Command

Export-NAVApplicationObject -DatabaseName 'Demo Database BC (14-0)' -Path 'D:\Blog\CAL_AL\Report207.txt' -DatabaseServer 'SRIDHARLAKSHMAN\BCDEMO' -ExportToNewSyntax -Filter 'Type=Report;Id=207'

You will be getting Report207.txt file after running the above command.

Converting the Objects to new syntax

The Txt2Al conversion tool (txt2al.exe) is only available with version 14, which is the last version to support C/AL.

You find the txt2al.exe in the "C:\Program Files (x86)\Microsoft Dynamics 365 Business Central\140\RoleTailored Client" folder.

  • Open Command Prompt Run as Adminstrator.
  • Run the following command 
    • cd C:\Program Files (x86)\Microsoft Dynamics 365 Business Central\140\RoleTailored Client        
    • Txt2Al.exe --source="D:\Blog\CAL" --target="D:\Blog\AL"  
  
You will get two files as we are converting report.
  • SalesCreditMemo.Report.al (Which is AL file)
  • SalesCreditMemo.Rdlc(which is Rdlc file), we need to convert this to Rdl file.

Here we have converted Sales Credit Memo report to AL, I have renumbered the id to save it in Custom series and can modify this report according to our requirement and publish it.

For more details regarding AL code: Stayed tuned with https://sridynamics.blogspot.com

Comments

Popular posts from this blog

Temporary Tables in Business Central

Temporary Tables in Business Central A temporary tab le is a temporary variable that holds a table. A temporary table is used as a buffer or intermediate storage for table data. You can use a temporary table just like you use a database table. The differences between a temporary table and a database table are as follows: A temporary table of data isn't stored in the database. It's only held in memory until the table is closed. The write transaction principle that applies to a database table doesn't apply to a temporary table. Today one of my colleagues addressed me with an issue: all the records are deleted in the sales price table while applying the original prices.  After Analyzing the Code, I found that the developer had missed setting  the  Temporary  property to Yes while declaring the variable, due to which the table was considered as a Physical table and deleted the data from the database.  In this post, I’ll address some common misconceptions and gi...

How to Create a Large Textbox in Business Central Using Control Add-ins

 If you’ve ever customized a page in Microsoft Dynamics 365 Business Central , chances are you’ve used the MultiLine = true property to enable multiline input for a text field. While this setting technically allows multiple lines of input, it comes with a limitation: you’ll only see about three lines before a scrollbar appears . This isn’t ideal for users who need to enter or read larger blocks of text. Fortunately, there’s a way to significantly improve this experience. By using a Microsoft-provided Control Add-in , we can embed a fully customizable HTML textarea element directly into a Business Central page. This gives us full control over its size, styling, and behavior—allowing a much more user-friendly and visually accessible text input area. In this blog, I’ll show you how to implement this using a real-world example: adding a custom work description field to the Service Item Card page. Instead of being limited to a few lines, our new implementation comfortably displays ...