다음을 통해 공유


Sample Extension v2.0 - Dynamics NAV / AL extension / SaaS - ALF Export Setup Tabs to Excel

In this blog post I will try to show an example of creating an extension v2.0 (AL extension).
This is will be the extension for Dynamics 365 for Finance and Operations, Business edition system (Cloud NAV), in other words: the app for SaaS environment.
A good start point for an extension story: Getting Started with AL
For the questions and searches you could use GitHub page: https://github.com/Microsoft/AL/issues
In my scenario I firstly create an object via classic way (Object Designer, on-prem version) and after that convert this object to AL object with use The Txt2Al Conversion Tool.

GitHub project:  https://github.com/finn777/ALF-Export-Setup-Tabs-to-Excel

Before start I have in my hands ---
- NAV 2018 (W1) CU 02, build 20348 system:

- Cloud sandbox (microsoft-sandbox):
Remember that you not one in this sandbox. // In general, you could see that Users page shows more than one line.
BUT if you need you always can do Reset Sandbox and start from a clean environment.

-Visual Studio Code with AL Language extension: // ‘Visual Studio Code’ is not ‘Visual Studio’

 

Well, what my extension going to do.
I’ll try to create a ‘processing only’ report that export a few Setup tables to the Excel.
An analog of how to do it via Configuration Packages:

We are trying to create Excel file via one click and add some improvements: all data on the one sheet, add some additional info and etc..

For the Excel export purpose I am going to use the functions from Table Excel Buffer (370).
I use report with no data item and with ProcessingOnly=Yes; UseRequestPage=No
Why I use a report? Because you could add Pages and Reports to Search in Cloud system. // Adding Pages and Reports to Search
During building an object that are going to be run under Cloud (SaaS) remember that not all functions / objects could be used in extension v2.0 (AL extension).
You should use function that has Property FunctionVisibility = External // Question: FunctionVisibility
Most virtual/system tables are currently not allowed for usage in AL extension. // Remember Modern DEV (AL) story is very fresh and change / improvement every month
I like this sentence from the on-line help (Testing your Extension):
Always test in a true Dynamics 365 for Finance and Operations, Business edition SaaS environment. If you test in on-prem, you might miss errors that would be seen on SaaS. My object ALF Export Setup Tabs to Excel (Original_on-prem).txt

You could run it in on-prem version:

Now let’s use The Txt2Al Conversion Tool

 

 cd C:\Program Files (x86)\Microsoft Dynamics NAV\110\RoleTailored Client

finsql.exe Command=ExportToNewSyntax, File="C:\Users\alexef\Documents\ALF Export Setup Tabs to Excel\Convert_Objects\Objects_on-prem_NewSyntax_NEW\ALF Export Setup Tabs to Excel.txt", Database="Demo Database NAV (11-0)", ServerName="RU-ALEXEF07\NAV2018", Filter=Type=report;ID=50126

txt2al.exe --source="C:\Users\alexef\Documents\ALF Export Setup Tabs to Excel\Convert_Objects\Objects_on-prem_NewSyntax_NEW" --target="C:\Users\alexef\Documents\ALF Export Setup Tabs to Excel\Convert_Objects\Objects_AL" --rename --type=Report --extensionStartId=70050126

Rename object according Best Practices for AL

Run ‘Visual Studio Code’:

AL:Go!

Set new folder for AL project: C:\Users\alexef\Documents\ALF Export Setup Tabs to Excel\AL\ALF Export Setup Tabs to Excel

Select from dropdown list: Microsoft cloud sandbox

launch.json automatically set like this:

app.json automatically set like this:

AL:Download symbols

Set “publisher” (!):

AL:Publish // F5

Okay, now close Visual Studio Code, go to our project folder, delete HelloWorld.all file and add Rep50126.ALF Export Setup Tabs to Excel.al file:

Open Visual Studio Code and comment function TempExcelBuffer.GiveUserControl:

Remember this function has FunctionVisibility = Internal // not External:

Set (uncomment) specific Cloud properties:

AL:Publish // F5

Now try to run object directly:
https://microsoft-sandbox.financials.dynamics.com/?report=50126

After re-login you could see that a user could search this object too:

And finally, you could see our extension in the list:

Additional info:

For you own Cloud sandbox you could use link:
Dynamics 365 for Finance and Operations, Business edition Sandbox tenant

You should set launch.json:

AL: Clear credentials cache


AL: Download symbols

Sign with e-mail that has been set during creation sandbox:

Now you can run AL: Publish … and later run report in system:

Additional info 2:
If you use https://aka.ms/bcsandbox to create your Business Central Sandbox Container Azure VM then set
launch.json:

app.json:

Comments