Copy the script and execute it - Your AL code will be ready in no time!
Senthil Kumar Varatharajan
Manager – D365 BC Technical Business Central at Mercurius IT| Microsoft Dynamics & SAP Solutions for better business | A safe pair of hands
Transitioning from C/AL to AL code can be challenging. This blog simplifies the conversion process directly from VS Code, helping avoid common errors that occur due to incorrect property syntax and extensive manual corrections.
Setting Up Your Environment
First, create these temporary folders to keep your files organized:
Second,
Copy Script
Set-ExecutionPolicy RemoteSigned
#Import the module for the Export-NavApplicationObject Cmdlet
Import-Module "C:\Program Files (x86)\Microsoft Dynamics 365 Business Central\130\RoleTailored Client\Microsoft.Dynamics.Nav.Ide.psm1"
#Import the module for the Split-NavApplicaitonObjectFile Cmdlet
Import-Module "C:\Program Files (x86)\Microsoft Dynamics 365 Business Central\130\RoleTailored Client\Microsoft.Dynamics.Nav.Model.Tools.psd1"
#Export objects from database Demo Database NAV (13-0)
Export-NAVApplicationObject -DatabaseName 'Demo Database NAV (13-0)' -Path 'c:\temp\CAL\StandardObjects.txt' -DatabaseServer 'FL-SQL-3' -ExportToNewSyntax -Filter 'Locked=1'
#Export objects from database D365BC_CUSTOM
Export-NAVApplicationObject -DatabaseName 'D365BC_CUSTOM' -Path 'c:\temp\CAL\ChangedObjects.txt' -DatabaseServer 'FL-SQL-3' -ExportToNewSyntax -Filter 'Locked=1'
# Create deltafile to make table extensions and page extensions
# export objects files as text from the develelopment environment
# Export both standard ojbects and changed objects
Compare-NAVApplicationObject -DeltaPath 'C:\Temp\Delta\' -ModifiedPath 'c:\temp\CAL\ChangedObjects.txt' -OriginalPath 'c:\temp\CAL\StandardObjects.txt' -ExportToNewSyntax
#Split the original source files to use it for comparision
Split-NAVApplicationObjectFile -Source 'C:\temp\CAL\StandardObjects.txt' -Destination 'C:\temp\CAL\Std'
Split-NAVApplicationObjectFile -Source 'C:\temp\CAL\ChangedObjects.txt' -Destination 'C:\temp\CAL\Custom'
# create the .al file
$getTxt2Alexe= "C:\Program Files (x86)\Microsoft Dynamics 365 Business Central\140\RoleTailored Client\Txt2Al.exe"
& $getTxt2Alexe --source 'C:\Temp\Delta\' --target 'C:\temp\AL' --extensionStartId 50000 #--objectFileNamePattern {id}.{name}.{type} --extensionObjectFileNamePattern {id}.{targetName}.{type}
#To get the file name from the specfic folders , this helps you to prepare Spreadsheet.
Get-ChildItem -Path "F:\temp\Src" -File -Name
Certified Technical Consultant ( Business Central) | Microsoft 365 Finance & Operation Developer & Entrepreneur | Tutor | Content Creator | Helping Businesses Streamline Processes & Maximize Efficiency
7 个月Great content
Microsoft Dynamics | Great Plains |Business Central
7 个月Very informative Senthil Kumar Varatharajan how to take care about about the standard object custom