Microsoft AL: AL language code samples for developing extensions #DYNDEV365

#DYNDEV365 , Microsoft AL by Microsoft Modern Dev Team

As you likely know, “Microsoft is developing new tooling for working with On Premise NAV and Dynamics 365 for Financials“. Those tools will be available later in December (announced some weeks ago @Directions Events) and in the meantime, we’d like to share some code with you so you can get familiar (and excited) about it.

We’ll add more code samples here but in the meantime, we’d really like you to:
Have a look at the “Hello World code” -> Check out the differences between classic C/AL txt format and the new .al format.




“Welcome to the code sample repo for developing extensions to Dynamics NAV.”

This repo contains AL language code samples for developing extensions on the Dynamics NAV platform. We’re not yet in preview, so this repo is meant as a way for you to get familiar with the new syntax and provide feedback.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact with any additional questions or comments.


Great Job ! .. “AL” you are Welcome !

by Microsoft Modern Dev Team,  #DYNDEV365

More Information About the Developer Preview for Dynamics NAV – 13/12/2016

by NAV Team,  #DYNDEV365


Dynamics NAV as SaaS …and 365 as IaaS

Dynamics NAV as SaaS (Software as a Service)
hi Guys,
some people have asked me information about this topic, below a little group of links about this topic (…old but actual).
ABOUT SAAS (Software as a service)
Introducing Microsoft Dynamics NAV Managed Service for Partners
Microsoft Definition:
“The Microsoft Dynamics NAV managed service enables Dynamics partners to easily offer SaaS solutions to their customers, deployed on Azure infrastructure and managed by Microsoft Cloud Engineers.  It reduces the operational, technical and administrative complexity of deploying and maintaining multi-tenant NAV solutions in the cloud while at the same time enables partners to leverage the latest and greatest Microsoft technology.”
“Following the launch of Microsoft Dynamics NAV 2016, we are pleased to announce general availability of the Microsoft Dynamics NAV managed service for partners, a significant new option for Microsoft partners  interested in providing multitenant Software-as-a-Service (SaaS) solutions built on Microsoft Dynamics NAV and deployed in the cloud on Microsoft Azure.”
The Microsoft Dynamics NAV managed service is a highly scalable and reliable platform-as-a-service offering that consists of:
Streamlined administration: A new management portal and web services API enable Microsoft partners to efficiently deploy, manage, upgrade and monitor Microsoft Dynamics NAV multitenant solutions on Microsoft Azure.
Simplified operations: Cloud-optimized licensing and billing helps partners deploy customers more quickly, manage users seamlessly, and receive a single bill from Microsoft for the service.
Microsoft Azure:  Auto-scaled, load-balanced and highly-available, the service utilizes Microsoft Azure, which includes many built-in benefits such as enterprise-class security, geo-replication, backup support, and point-in-time restore.
24×7 support from Microsoft: Microsoft Cloud Engineers monitor and maintain partner solutions, customers, and users, offering Microsoft partners a financially-backed SLA of 99.9% availability.
The Microsoft Dynamics NAV managed service has been in preview since April 2015, with partner solutions and customers live on the service today.
Partners interested in the Microsoft Dynamics NAV managed service can find more information at:
…some other useful links:
Microsoft Dynamics NAV 2016 now available, as is Microsoft Dynamics NAV 2016 managed service for partners
ABOUT IAAS  (Infrastucture as a service)
and now … “THE IaaS ERA”… (from NAV TechDays 2016- Mibuso)
nice video here:
THE “NAVTechDays 2016 Playlist” (ALL VIDEOS)

WPC2016, Milano, 29-11 01-12

WPC2016, Milano, 29-11 01-12
“OverNet Education”, il principale Partner per la formazione e la consulenza IT delle aziende Italiane, Enterprise e PMI, è lieta di presentare la 23ma edizione di WPC (WPC 2016), la più importante conferenza italiana sulle tecnologie Microsoft.
L’evento in cui una community di oltre 400 IT Professionals si incontrano per trasformare il proprio business.
presso NH Centro Congressi Assago
…dato che sono stato invitato da OverNer Education, sarò presente il 30-11 mattina in MVP Corner, passate a trovarmi !
…you are welcome !

NAV 2017 “Task Scheduler”

In this post i will write about “NAV 2017 Task Scheduler”,  NAV 2017 Task Scheduler is an evolution of Job Queue Technology (ex Process Queue, Microsoft returned to old name for name for Job Queue..); Microsoft has reviewed\improved\extended the old Job Queue Technology and now Task Sheduler is a great new feature ready for “Complex Scheduling” useful in various scenarios.

MSDN Definition: “The task scheduler enables you to control when certain operations or processes (in other words tasks) are run. Basically, a task is a codeunit or report that is scheduled to run at a specific data and time. Tasks run in a background session between the Microsoft Dynamics NAV Server instance and database. Behind the scenes, the task scheduler is used by the job queue to process job queue entries that are created and managed from the clients.”


How “New Task Scheduler System” works

Now we have a new option in NST: “Task Scheduler enabled” option; when a task is executed, the task is not visible in sessions list (is a background session).

Task Scheduler enabledoption says to NST to start a background session for each task that needs to be executed at scheduled time. After the execution of task is completed, the background session is closed (no more phantom\pending sessions to kill by SQL jobs !)


Another useful option on NST permit to define how many simultaneous tasks can be executed by NST at the same time (parallel execution on NST). Killing a session will not stop all other tasks that need to be executed (..a different pipeline for each task execution)


“Task Scheduler Technology” Objects involved

  • Table 2000000175 Scheduled Task   (Show list of scheduled task)


task 13.png


  • Table 2000000111 Session Event   (Show list of active background sessions started for each running task)

“Job queue” Codeunits


Below Some Details of New Task Scheduler Feature

C/AL Code and Task Scheduler

In C/AL code, you create and manage tasks by using the C/AL functions that are available for the TASKSCHEDULER data type.

Task Scheduler Data Type

The TaskScheduler data type is a complex data type for creating and managing tasks in the task scheduler, which runs codeunits at scheduled times.

“ALL” Task Scheduler Functions

Function Description
CREATETASK Adds a task to run a codeunit at a specified date and time.
SETTASKASREADY Sets a task to the Ready state. A task cannot run until it is Ready.
TASKEXISTS Checks whether a specific task exists.
CANCELTASK Cancels a scheduled task.

 “How “ Task Scheduler Works

To set up a task, you create a codeunit that contains the logic that you want to run at a scheduled time. Optionally, you can create a second codeunit that contains the logic to handle the task if an error occurs for any reason. This coduenit is referred to as a failure codeunit. Once you have the codeunits, you can add C/AL code to the application that calls the CREATETASK function to schedule a task to run the codeunits. The CREATETASK function can also specify the earliest date to run the task, and whether the task is in the ready state.

Task Scheduling “Flow”

Here is an overview of the process that a task goes through:

  1. After you add a task, the task is recorded in table 2000000175 Scheduled Task of the database.
  2. If the task is in the ready state, when the scheduled time occurs, a new background session is started and the task codeunit is run.

You can view the session in the table 2000000111 Session Event.

If an error occurs, the following happens: 

  • If a failure codeunit is not specified, then the retry flow is initiated.
  • If a failure codeunit has been specified, the error is passed in a call to the failure codeunit, and the failure codeunit is run.
  • If the failure codeunit does not handle the error or fails itself, then the retry flow is initiated.

Error Conditions and Retry Process

A task can fail under the following conditions:

  • The company cannot be opened.
  • An SQL connection or transient error occurred with the database.
  • The Microsoft Dynamics NAV Server instance restarted while the task was being run. When an error occurs, unless the task is interrupted by the failure codeunit, the Microsoft Dynamics NAV Server instance will rerun the task according to the following flow:
  • You can view these errors in the event log of the computer that is running the Microsoft Dynamics NAV Server instance.
  • Two minutes after the first failure
  • Four minutes after the second failure
  • Fifteen minutes after the third failure and subsequent failures.

About Task Sessions and Permissions

The task runs in a background session, which means that there is no user interface. The behavior is similar to that of the STARTSESSION function, where any dialog boxes that would normally appear are suppressed. For more information about specific dialog boxes, see STARTSESSION Function (Sessions).

The session runs by using the same user/credentials that are used when calling C/AL code. The user must have appropriate permissions to the codeunit and any other objects that are associated with the operation of the codeunit.


Create Task Function

Adds a task to run a codeunit at a specific time.


[Task =: ]CREATETASK(CodeunitId, FailureCodeunitId[, IsReady][, Company][, NotBefore][, RecordID])


The following example schedules a task to run the Job Queue Dispatcher and uses codeunit Job Queue Error Handler as the failure codeunit. The code requires that you create the following C/AL variable.

Variable DataType SubType
JobQueueEntry Record Job Queue Entry

C/AL Statement







NST Reporting Parameters (nice for SAVEAS function and for reporting scheduling also)


Sample of Report Scheduling




My final considerations:  New Task Scheduler is Great feature ! ….now Task Scheduler is a real scheduling application like windows task scheduler or Unix Crontab etc… a great step beyond!!

Have a nice task scheduling !!

NAV 2017 “Assisted Setup”

in this short post, i will talk about a new feature of NAV 2017: “Assisted Setup”.

Assisted setup” is a nice feature (composed by a lot of wizards ready to use..) useful to guide your users through setup scenarios.
With this feature is possible:
– use a predefined set of data to setup main features (for selected areas)
– have a great first setup configuration for your new company (enhanche first-time experience)

List of some wizards ready to use:
– Setup Company (Configurator for first one access)
– Approval workflow
– Item Approval
– Power Bi embedded configutation (Azure directory)
Setup Reporting
– Office 365 integration
– Dynamis CRM connection
– email logging
etc. etc.

My example: “Setup Reporting”
Setup Reporting” is a nice feature (wizard) to configure OData with fields selections, all in only “one shot” configuration.
Definition\Scope: “you can create data sets for building report in excel, Power Bi, Odata..”

below some “step by step” pictures.





“item list” Data Set Configuration with fields mapping




“Item list” is published like Web Service & OData


“item list” json output from OData


you are welcome.

Welcome to Microsoft Dynamics 365 !

Evolve your business on your terms

“With intelligent business applications across CRM and ERP, Microsoft Dynamics 365 gives you choice. Start with just what you need to run your business—and delight your customers. And then add apps as your needs change.”


dynamics 365 launch.png

Dynamics 365 Blogs & Communities

Dynamics 365 Blog

Dynamics 365 Documentation

Explore Dynamics

Dynamics Community “Business & Enterprise” new sections

“How-to” support pages

Dynamics 365 Team Blog (from CRM to…)

“Welcome to Microsoft Dynamics 365 !” launch video

“ALL About” C/AL Coding Guidelines


hi guys, this is another short post of my “ALL About” posts series (the first of this year); in this case i want to write about “C/AL Coding Rules and Guidelines”.

below a short list of documents\pages about this topic,

First “ALL IN ONE” Document but “ALWAYSuseful is:  “C/AL Coding Guidelines used at Microsoft Development Center Copenhagen”  …”The Bible” for each C/AL Developer!

Source: C/AL Coding Guidelines used at Microsoft Development Center

you can download PDF document here: cal-coding-guidelines-at-microsoft-development-center-copenhagen

“ALL IN ONE” Document Vs Wiki & Community Feedback Philosophy

CAL-Coding-Guidelines-at-Microsoft-Development-Center-Copenhagen.pdf” is “all in one document”. In contrast, on this wiki, the coding guidelines are published individually. The reason is: give you the chance to comment and share your oppinion on each one.

Question: Since we’re having the guidelines, how come there is still C/AL code in NAV which doesn’t respect them?

Answer: all new C/AL code is bound to follow the guidelines (else it cannot be checked-in). However, the code that existed before the rules – it does not. We had done cleanup in a certain degree. Now we’re gradually improving the old code base as we visit various objects in order to add new functionality, however chances are that code we didn’t touch in a long time had remained in its old form.

“Microsoft Dynamics Community is looking forward to your comments!  Where you can, do provide concrete examples of the alternatives, Good and Bad”

Wiki Page on Design Patterns

other nice resources:

nice doc on Mibuso about “How to work with record-variables”:

Nice general sections on MSDN

General C/AL Programming Format

Programming Best Practices

C/AL Comments

C/AL Coding Guidelines Video