NAV 2017 not documented options for “Credential Type”


In NAV 2017 there are two new options for “Credentials Type”: TaskScheduler and EchangeIdentity.

“Credential Type” -> “AS IS” Documentation
“Specifies the authentication mechanism for Microsoft Dynamics NAV users of this Microsoft Dynamics NAV Server instance.”
The options are “Windows, Username, NavUserPassword, and AccessControlService”.

But… What about others features ?  “TaskScheduler”, “EchangeIdentity”, “None” ?

In reality now there are three not documented options in the online help and also in NAV admin console help: “TaskScheduler”, “EchangeIdentity”, “None”   …the option “None” was already existing in 2016, undocumented.

NAV 2016

nav-2016-1

NAV 2017

nav-2017-2

nav-2017-3

I asked Microsoft to update the documentation on MSDN (not updated from NAV 2016), useful in explaining exactly the “scope” and the “ByDesign” concept of each option.  I’ll let you know!  .

I have the solution (23/03/2017..) !.. Thanks to Microsoft…  -> “These options are for Dynamics 365 for Financials” .. IASS applications !!!  .not for NAV.

MSDN – “Users and Credential Types”
https://msdn.microsoft.com/en-us/dynamics-nav/users-and-credential-types

 

Some old posts

I have already talked about the new task scheduler and new NAV Admin console options previously, below some links that can be useful.

NAV 2017 “Task Scheduler”
https://robertostefanettinavblog.com/2016/11/04/nav-2017-task-scheduler/

NAV 2017 – What’s new in the Administration Console
http://www.pakiki.info/2016/11/01/nav-2017-whats-new-in-the-administration-console/

How to force specific service instance in Task Scheduler in NAV 2017?
http://forum.mibuso.com/discussion/68576/how-to-force-specific-service-instance-in-task-scheduler-in-nav-2017

Advertisements

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.”

Source https://msdn.microsoft.com/en-us/dynamics-nav/task-scheduler

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 !)

task1

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)

 task2

“Task Scheduler Technology” Objects involved

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

task17

task 13.png

task-16

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

“Job queue” Codeunits

task15

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.

Examples

Create Task Function

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

Syntax

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

Example

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

TASKSCHEDULER.CREATETASK(CODEUNIT::”Job Queue Dispatcher”, CODEUNIT::”Job Queue Error Handler”, TRUE, COMPANYNAME, CURRENTDATETIME + 1000 + RANDOM(3000), JobQueueEntry.RECORDID);

Source https://msdn.microsoft.com/en-us/dynamics-nav/createtask-function

“JOB QUEUE” IMPROVEMENTS

task5

SET STATUS TO “ERROR” FEATURE

task6

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

task10

Sample of Report Scheduling

task7

task8

task9

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 !!