AL, Business Central, Development Tips, Extension Package, How To, Information, Modern Development Tool, Tip & Tricks, V2, What's New

AL Basics – Part 6 [Publishing & Testing Extension]

Today we will see in our post how we can Publish & Test our Extension.

To be able to follow this steps discussed below you should have gone through my earlier post and your project is ready to continue from where we left in our previous post. If yet not please follow below links and continue their after to this post.

Bare Minimum Steps to Start with fresh Extension Project for Business Central

AL Basics – Part 2 [Table]

AL Basics – Part 3 [Table Continued]

AL Basics – Part 4 [Page]

AL Basics – Part 5 [Extending Table & Page]

Since we are going to continue same project, reason why I am asking to have it as we will be referencing to the objects we created in above posts.

Let’s begin with our today’s task.

Ext-7

Now we have all required basic stuffs to Publish our Extension.

To Publish your Extension first need to Build and Package your Extension.

Although you can Package & Publish in single command, follow as you feel comfortable.

Press <Ctrl> +<Shift> + <P> to access your Command Pallet.

Ext-8

Chose AL:Package to create Package.

Ext-9

At this stage your package is ready for deployment/Publish.

Next we will Chose AL:Publish from Command Pallet.

Ext-10

This will create Package and Publish to your server as given in launch.json file.

Just previous step is optional to create Package, but it is helpful in case you want to just create a package but not publish to your server, may be you have tested and creating final package for delivery to your customer.

Whatsoever, we are now ready to test our Package/Extension.

You may get below error:

The request for path /BC130/dev/metadata failed with code InternalServerError. Reason: NetFx40_LegacySecurityPolicy is enabled and must be turned off in the Microsoft.Dynamics.Nav.Server.exe.config file.

Locate the file from installation folder in my case: C:\Program Files\Microsoft Dynamics 365 Business Central\130\Service

Ext-11

Set value to false save and replace the config file.

Restart your Service, and try publishing again.

You may get error:

Error: Could not open the specified startup page. Please check that the server configuration key PublicWebBaseUrl has been properly set.

That’s not a problem you can ignore it, actually it is trying to open WebClient and launch the Object you specified in launch.json file.

Open your Client and browse Extension Management.

Ext-12

Your Extension is published, & you can check the information that you provided in app.json file is visible.

Now Let’s Test our Extension.

If you remember we have integration point on Sales order line, so to see our extension in action we need to check our Sales Order Line.

Ext-13

You can see the fields that we added in our Page Extension is visible on Sales Order Line.

You can add your data and start using the extension.

If you remember we also added Appointment Calendar Setup Page to the action on Loadout Point Page.

Ext-14

If you check the Objects in your database you will not find these objects in Object designer, so where is my all data stored & saved.

To find them you need to check in your SQL database.

Your Tables are name defined with postfix your application ID.

Sales Line Extended Table data.

Ext-15

Loadout Point Table data.

Ext-16

Working Calendar Time Slot.

Ext-17

Appointment Calendar Setup.

Ext-18

Hope you enjoyed Publishing and playing around with your First Extension.

I will come up with more advanced features and tips on Extensions in upcoming posts.

Keep Learning, remain safe and stay tuned for more in upcoming posts.

Advertisement
AL, Business Central, Development Tips, Extension Package, How To, Information, Modern Development Tool, Tip & Tricks, V2, Visual Studio Code

AL Basics – Part 5 [Extending Table & Page]

Today we will see in our post how we can extend our Existing Table & Pages.

To be able to follow this steps discussed below you should have gone through my earlier post and your project is ready to continue from where we left in our previous post. If yet not please follow below links and continue their after to this post.

Bare Minimum Steps to Start with fresh Extension Project for Business Central

AL Basics – Part 2 [Table]

AL Basics – Part 3 [Table Continued]

AL Basics – Part 4 [Page]

Since we are going to continue same project, reason why I am asking to have it as we will be referencing to the objects we created in above posts.

Let’s begin with our today’s task.

Create a new .al file, fresh new file. We can write all our code in single file but we are following to have one object per file so that it is easy to manage in future, as any even small customization will involve many of the objects.

First we will extend a Table from Sales Line and add some fields with reference to the existing Table Loadout point we created in our earlier post.

Ext-1

This will give us the basic structure of the Table Extension.

Ext-2

We need to Provide Unique ID, Name of Extended Table & from which Table we want to extend our current Table.

Ext-3

Now Rename & Save your File.

Next we will extend a Page to add this 2 new fields.

Now we will extend a Page from Sales Order Subform and add above fields.

Create a new .al file, fresh new file.

Ext-4

This will give us the basic structure of the Page Extension.

Ext-5

We need to Provide Unique ID, Name of Extended Page & from which Page we want to extend our current Page.

Ext-6

Now Rename & Save your File.

I have added an action to our existing Page Loadout Point List Page to link the Appointment Calendar Setup Page, just for demo purpose, we fill find suitable place to add same in our future post.

Ext-6-1

After this step we are done with one small/basic extension which we can Publish and check the output.

We will see this in our next post.

AL, Business Central, C/AL, Development Tips, Extension Package, How To, Information, Modern Development Tool, Tip & Tricks, V2

AL Basics – Part 3 [Table Continued]

In last post we saw basics of how to Create Table and created a Loadout Point Table.

Today we will continue from where we left in previous post. If you missed previous post you can find here AL Basics – Part 2.

We will create one New Table say Working Calendar Time Slot. Since no new concept used in this table so without explanation I will directly share the final structure of this Table. I am using this table in today’s next Table which I will be creating later below.

So here is the structure of this Table.

TAB2-1

Now coming to today’s topic. Creating Field Triggers & Functions.

I will be creating a new table Appointment Calendar Setup.

Here is the structure of same, and explanation follows after screen shot.

TAB2-2

In this Table the Loadout Point field TableRelation to the Loadout Point table that we created in our previous post.

Similarly the field Start Working Hrs. & End Working Hrs. field, OnValidate() trigger is implemented which call to a function/procedure CreateTimeSlot() defined in this table itself.

Field Start Working Days & End Working Days is defined with option type.

When user Enters the Start Working Hrs. & End Working Hrs. we will create the Time Slot for that Location (Loadout Point).

Finally I have created a local procedure in the table, which as per the information entered it creates the Time Slot in Table we created above Working Calendar Time Slot. Also see I have created few local variables to the function of different types. You can see there is no difference in writing the code, it follows same syntax as in our Navision C/AL. Advanced coding options and what’s new will discuss separately in future posts.

Till here we have our basic structure of our Extension. We will see how to design page in our next post.

We will come with more advance points on Table Later as we proceed in completing our Extension. There is lots of things to share on this topic but sometime later in future posts. First Let us cover all Object Types.

AL, Business Central, Development Tips, Extension Package, How To, Information, Modern Development Tool, Tip & Tricks, V2

AL Basics – Part 2 [Table]

Today we will discuss about tables.

To Create a Table Create filename.al file, as one shown in example. Folder is not compulsory, I am using to just keep my files in arranged way.

TAB-1

You can choose File -> New File or press 【ctrl】+ N or using tool button on Project folder as shown above. Give meaningful name and .al extension is a must.

Once you get your file in editor, you can start coding from scratch or can take the help of Snippet ttable and continue their after.

Let see what happens if I type ttable in the editor window.

TAB-2

As you start typing the assist window will guide you with available options.

You can press anywhere you will get the list of options available for that section.

We will see this in a while.

First let understand different sections in table object where you will write your codes, or set properties etc.

You can remove your Global Variable and Trigger section if you have nothing to define or not required in your case.

TAB-3

Suppose you are in Table property section and want to know what all properties are available in AL you can place your cursor at desired place and press 【ctrl】+ < Space Bar>. A list of options available will be shown to you, you can select required property and complete your syntax.

TAB-4

Similarly you can do in other sections of table structure also, you will always get the list of things you can do in that section.

Let’s complete our one sample table, with few Table Property, Fields and Fields Property, Keys.

TAB-5

This is a sample Table.

I have commented DrillDownPageID & LookupPageID Table Properties as this page are not available at this stage will add later.

I have defined Caption & TableRelation for my field Depot.

Caption for Field “Slot Duration” also Option String and caption for same.

I have defined Primary Key for the table.

I have defined the fieldgroup for Dropdown.

At this moment I don’t want to define Global Variables and Triggers for this table so removed.

We will get into more details in our next post.

AL, C/AL, Development Tips, Extension Package, Information, Modern Development Tool, NAV 2016, NAV 2017, NAV 2018, PowerShell, Tip & Tricks, upgrade, V1, V2, Visual Studio Code

Future of Navision is extensions V2?

With the release of Dynamics 365 Business Central a successor of Dynamics NAV, things are going to change. If I am not wrong from year 2020 Modern Development Environment will be the only platform available to developers.

In every NAV upgrades biggest challenge was customizations, since objects are fully accessible to developers, so we customize the solution as we want as a developer spreading unstructured, difficult to maintain, customized code everywhere and in all objects.

The beauty of product is, it is totally customizable and adaptable to customer’s business. Customizing Navision is easy and quick to deploy. C/AL is easy to learn and code.

Due to these heavy customizations and unstructured codes upgrade to new version of the product required long time and efforts. Hard to merge, too much efforts leading to high cost, usually many customer prefer to stay with their current version, and miss new capabilities of product available in future versions of Navision.

With release of NAV 2016 concept of extension was introduced. This introduced the concept of writing code isolated from the core objects and use events to interact with the standard codes. Now create the extension that can be installed or uninstalled any time without affecting the original base layer of the product. We call it extension V1.

These were also developed using C/AL and deployed using PowerShell. But still it always felt like something is missing. Then last year Microsoft came up with release NAV 2018 which introduced second generation of extension, we call it extensions V2.

This introduced completely new development platform based on Visual Studio Code Modern Development Environment. It uses new AL language an evolution of C/AL. Now this will be the future.

Dynamics 365 Business Central platform (on-premise and SaaS) uses this development model. Probably this will be the only development platform available from year 2020.

In Business central base application is now an entire extension based with some system objects in CSIDE, In future release you may not have any more side by side development, you will only be having AL and extensions.

 

So what next?

 

  • We should now concentrate on learning VS Code and AL as in future this will be the only way to modify the application.
  • Now we need to make our self-familiar with the Web Client as Windows Client will be obsolete soon.
  • We should start moving our all customization to extensions.
  • Now we should start thinking in direction of AL type customization rather than old C/AL type coding practice.

 

What do you think?

I will come up with more details as progress in this direction. Till then keep learning and sharing with others.