#NAVdevTips 2: From AL to T

I know that this post for some people will not be discovering something new. All (or AL) what you can read here, you can easily find on Microsoft Docs. However I also believe that there is a lot of people, even senior developers, who still did not wrote a single line of code in AL. As we know not everyone have time or still there are not so many projects which gives us opportunity to know AL better.

Therefore I want to write about letter T which in AL is very very helpful and can be time saving. T for Template? Probably yes – at least this is how I understand it however the proper name is snippets.

Let’s start from example. How to create new table? In C/AL it was quite easy now we need to do little more but we can use shortcuts. So when you write in AL – ttable (yes double t) you will get new table object structure with all necessary things needed to create a table

Now you just need to put object number, name, all fields and keys – yes you need to put all of that. The result of our ttable you can see below (triggers for table are already there).

So what more we can get with t…?
I will start not from objects which are basics but from something which we did not had in C/AL and this is pretty nice feature. Now we can easily add repeats, ifs, cases and much more.

Code statements:

tcaseelse – case statelement with else
tcaseof – case statement without else
tfor – for statement
tforeach – foreach statement
tif – if statement with begin and end. So rather not to use if you need just one line after if
tifelse – if statement with begin and end else
tisempty – isempty statement with begin end. To be honest I would prefer statement NOT isempty as for me it is more useful
tisemptyelse – isempty statement with begin end else
trepeat – repeat loop with begin end
twhile – while statement
twith – with statement


Like with table on top of this post we can quickly build all other objects base on predefine structure. Only one which is missing is MenuSuite as it is no longer needed.
tquery – new query
treport – new report
txmlport – new xmlport
tpage – here we can choose either we want to get new List or new Card
tcodeunit – new codeunit

Objects needed for extensions:

tpagecust – new customization of standard page
tpageext – new extension of standard page
ttableext – new extension of standard table


tprofile – allow us to create new profile with page customizations


There are three types of events which we can create with shortcuts: business, integration, subscriber.

teventbus – allows to create business event
teventint – allows to create integration event
teventsub – allows to create subscriber even

Fields and Keys in Table:

I think using shortcuts for fields or keys can be useful but to be honest it is not very time saving at least for me. Especially because adding fields not gives us any directions how to write properties – anyway we need to write them manually.

tfield – new field without type (we need to put manually)
tfieldbiginteger – Big Integer type
tfieldboolean – Boolean field
tfieldblob – Blob field
tfieldcode – Code field. You will need just to put length of field
tfielddate – Date field
tfielddateformula – Dateformula field
tfielddatetime – Datetime field
tfielddecimal – Decimal field
tfieldduration – Duration field
tfieldguid – GUID field
tfieldoption – Option field. In this case OptionMember property is automatically added
tfieldrecorid – RecordID field
tfieldtext – Text field. You will need just to put length of field
tfieldtime – Time field
tkey – adding new key to table

Triggers and Procedures (functions):

Now to add triggers as OnValidate, OnLookup or any other we need to write them. At least we have ttrigger which gives us the whole structure.

To add new function in our code we need to use procedure. Also for this basic structure had been provided – tprocedure. As default function is set to local



Fields and Actions on Page:

If we want to add field to page we can use tfieldpage. However for me it is easier to just add field manually but this is my personal opinion.

For actions we also can use template taction and this is more useful.

Note: NAV team is adding new s

Add a Comment

Your email address will not be published. Required fields are marked *