Saturday, December 24, 2016

Preview of Dynamics NAV Development Tools - How to get Started

I think most of you know by now already that Microsoft has released new Development preview for Dynamics NAV. If you still not updated on that yet, then refer below link on the Preview of Development Tools for Dynamics NAV



In this blog post we are going to talk about how to get start with new development tools. Currently all these tools are available in a Azure VM. Therefore we required to create a new VM in Azure. Microsoft has already created a deployment template for you and all you need to do is fill the blanks in the template. 

Once that is done it will automatically deploy the VM for you. So lets get started.. 

Step 01 : Create Azure Subscription 
If you does not have a Azure account then you can try the free account. To create a new free subscription refer below link : https://azure.microsoft.com/free/


Step 02 : Deploy Azure VM
Click on below link, which will take you to custom development template in Azure. While doing that it might ask you to login to your Azure Subscription. 
http://aka.ms/navdeveloperpreview



When the Deployment complete give it 10-15 min more until the Virtual Machine is initialized and VS Code has been installed and configured for you.

Step 03 : Connect to Virtual Machine
Select the Virtual Machine (Server1) like below and in next screen click on "Connect". Which will download the "Remote Desktop Connection"


Enter the "vmadmin" password to connect to Virtual Machine. 

Once you connect to Virtual Machine you can see the below Desktop Icons which will allow you to open Web Client of Dynamics NAV and Visual Studio Code. 

Stay tune for next blog post on how to use Visual Studio Code to develop extensions for Dynamics NAV and how to use Web Client to rearrange pages.  

Please provide your feedback with a comment. 
Thank you and Regards,
Tharanga Chandrasekara

Tuesday, December 20, 2016

Preview of Development Tools for Dynamics NAV

Microsoft has deiced to give an early Christmas gifts to the world by introducing new tools to build extensions and apps in and for Dynamics NAV

Tool comes in two flavors and both are available in preview from today (21/12/2016).

The in-client designer
Before talking about it, just have a look at the below gif. I'm sure most of you will love the idea. No need to go back to developers to add a new field to a page. It is all can be done in the client window itself. 

This will allows to drag and drop interface, rearrange fields, rename-groups and reposition element to build perfect extension to support an industry-specific solution or implement a business process optimization.




Visual Studio Code
Use the AL Extension for NAV in Visual Studio Code to build powerful extensions based on tables, pages, and codeunits using the new objects: Page Extensions and Table Extensions. 


If you need to know how to start on using these great tools click here to access Microsoft official announcement.

The official short URL is : http://aka.ms/navdeveloperpreview

This looks so promising already and we are still at the preview.. 

Please provide your feedback with a comment. 
Thank you and Regards,
Tharanga Chandrasekara

Sunday, December 11, 2016

Understanding COMMIT and Transaction Scope within Microsoft Dynamics NAV

Have you tried and thought about what is the transaction scope. In this blog post I am going to discuss little bit about transaction scopes and how the transaction scope works within Microsoft Dynamics NAV. 

In order to check the simple scope I am planning to use below code. Pretty simple, its just inserting a record to Customer Table (T18) and trying to run a report using RUNMODAL


Even before we execute the code most of you knew what will happen if we try to run the above code. You will get most probably the largest or second largest error message in Dynamics NAV. 


What will happen if we add a COMMIT


It runs without any issue and open up the Report Request page as define in the code. What this means is that once the COMMIT is called it will end a write transaction scope.

Following is the definition for COMMIT in MSDN :
When a C/AL codeunit begins, it automatically enables write transactions to be performed. When a C/AL code module completes, it automatically ends the write transaction by committing the updates made by the C/AL code. This means that if you want the C/AL codeunit to perform a single write transaction, it is automatically handled for you. However, if you want the C/AL codeunit to perform multiple write transactions, you must use the COMMIT function to end one write transaction before you can start the next. The COMMIT function separates write transactions in a C/AL code module. (Link)
In simple COMMIT statement ends active Write Transaction. Refer below image to understand how the transaction scope is defined. 


Lets do a small change, 

When we run the code system throw out the Error message. Even though the error happen after the insert statement system rollback the transaction and move to the last system state. This is a one reason you never have to handle the transaction scope manually by you, NAV does it for you.  (Beautiful!)

Lets do another change to our code, I removed the error code and added new code segment. 


What will happen if we run this code? Wll get the same error what we received when we run the first segment of the code. However there is one small interesting thing in this code, to check that will open the RTC. 

Dynamics NAV has inserted the first customer record to the table and never rolled back even though the error has occurred. Reason behind that is can be understand easily by referring to below image :

Once we do a COMMIT manually, Dynamics NAV register those transactions in Database and never go back and undo the changes even though error occurs afterward. 

Therefore during the C/AL coding it is highly important to use COMMIT statement very wisely. If you use the COMMIT code without identify possible issues and identify them and handle them properly, your Database will end up with uncompleted transactions and then you might have to go and manually correct those records. 

Within Dynamics NAV Default Code: 
In some of the Dynamics NAV Default codeunits, COMMIT is been used inappropriate ways (my view), easiest example is in the Sales-Post codeunit. There are sevaral COMMIT statments within the codeunit which complex the process. 

As an example, system COMMIT after the Posting No. is assigned to a document and IF the document gets an error afterwards No. Series never get rolledback. If a user tried to delete the document then it will have a number gap in the posting documents. 

Reason behind COMMIT in the sales-post is to release the tables that was grabbed so that other posting routines can use those tables. There are ways around it and will discuss about those on futuer blog posts. 

Will the Temporary record works same with COMMIT? Await for next blog post.. 

Please provide your feedback with a comment. 
Thank you and Regards,
Tharanga Chandrasekara

Friday, December 9, 2016

Overview of User Permission : Microsoft Dynamics NAV

During last few versions of Microsoft Dynamics NAV, Microsoft has introduced some cool new features. One of my favorite is user permission (It has a long way to go, but it is getting there) .

CRM and User Permission :
If you have worked with Microsoft Dynamics CRM you might have noticed how good (cool) is the user permission assignment in it. It is very easy and show the overall picture of how the user permission is assigned. (Below is a sample image of Dynamics CRM User Permission)



Pain with Dynamics NAV Permission :
During most of the implementations I have involved, we always got a complain that Dynamics NAV user permission is complex and is there way to do it much simpler way. Some of the cases we had to go for a add-on to ease the pain and most of the time company IT Admin had to live with the pain as the add-ons are much expensive. 

Main issue we faced is that Dynamics NAV did not had a central location to control the user permissions and also the way permission recording works. 

During last few release of Dynamics NAV product line, it seems Microsoft has identified the pain of IT Admins and they have come up with a much simpler solution to ease the pain. This may be not a perfect solution but we are almost there. 

Permission Sets :
If you navigate to Users  using department or using "Google Search" of Dynamics NAV, you can see few options on the ribbon. Today I will only go through the "Permission Sets" and will come back to "User Groups" on a different post. 

As a first step if you click on the "Permission Sets" it will open up a window with all the permission sets available in the Dynamics NAV. 

This is not new, this was always there (most of the versions) in Dynamics NAV. New about this screen is now you have a factbox or I would see Zoom-In box on the right side of the page. When you click on a permission set you can see the overview of the objects which are assigned to the selected permission set. 


Yes, it does not show the permission assign to each object, but if you want to see the well detailed version you can click on the "Permissions" button on the top of the ribbon. 



Details of the permission set include below details on the screen. It allows Admin to control what are the objects that user should have access and how the access should be. If a Admin required only to provide read permission to a object (depend on the object type), that control is available. 

Security Filter :
With the security filter Admin can apply a data based filter to the permission set. Check below example :



Ex : If a user should only see a invoices of one selected customer then Admin can add the Sales Header table and add appropriate data filters. Like wise many data filters can be applied and have a 100% control over the user permissions.

Permission Sets by User : Next lets check on my favorite functionality in the Permission Sets, which is "Permission Sets by User" 



This is a one perfect solution for a lack of "Permission Control Center" in Dynamics NAV. With this new feature Admin can see the complete overview picture of the companies assigned user permissions and more beauty is just with a click, admin can assign and remove a permission set from a user and does not have to go to each user profile and assign the permission like past.  Below is a sample of the "Permission Sets by User" control center. 


Below is the ribbon of the  "Permission Sets by User" control center and it allows to copy a permission set to a new permission set and also to view the detailed version of permissions. 


Hope you learned new things from the blog post or at least refresh your memory. 

Please provide your feedback with a comment. 
Thank you and Regards,
Tharanga Chandrasekara

December 2016 Cumulative Updates for Microsoft Dynamics NAV

Microsoft has published new Cumulative Updates for December 2016: Please refer below links for more information


If you had faced any trouble of copying a new company (Timeout the process after around 1 hour time) in a Azure hosted DB, then you might want to look at the CU Update 14 for Dynamics NAV 2016 and CU1 for Dynamics NAV 2017. 

In the current CU it will fix the the Import-NAVData cmdlet and it will require platform update. 

This will not fix the issue 100% but will fix half of the problem. Rest of the issue (Copy Company via Dynamics NAV) will be fixed most probably in the next CU update. 





It is always good to update your environment to latest Cumulative Update.

Please provide your feedback with a comment.
Thank you and Regards,
Tharanga Chandrasekara

Thursday, December 1, 2016

Modern Dev Experience in NAV

It is a new chapter for Microsoft Dynamics NAV Community! 

Microsoft has released new AL language code samples for developing extensions on Dynamics NAV plaform. Thank you Microsoft Dynamics NAV development team for making this a sucess and releasing this early preview. 

Take a look at how a simple "Hello, World!" codeunit would look like in new syntax. (Ya ya.. Object IDs are still there)


 // ------------------------------------------------------------------------------------------------  
 // Copyright (c) Microsoft Corporation. All rights reserved.   
 // Licensed under the MIT License. See License.txt in the project root for license information.   
 // ------------------------------------------------------------------------------------------------  
 codeunit 70051001 HelloWorld  
 {  
   TableNo = Customer;  
   trigger OnRun();  
   var  
     HelloText : Codeunit GreetingsManagement;  
   begin  
     Message(HelloText.GetRandomGreeting() + ', ' + Rec.Name);  
   end;  
 }  

It looks very good and at the first glance codeing looks more like C#, which is good because it will attract new developers to the NAV world.

With new development experience we get a totally new file extention .AL

According to Microsoft, new VS Code development is used for extension development for Microsoft Dynamics NAV and also for Dynamics 365. This means at this stage we still have to stick with the existing Development Enviornment for all the other Dynamics NAV related developments. However in futuer Dynamics NAV Development Environemtn will say goodbye to the NAV world. 

You can access the new released code samples from below link: https://github.com/Microsoft/AL

Looking forward to play with Visual Studio development environment preview which may available for Christmas.

Rome wasn’t built in a day! But we are getrting there!

Please provide your feedback with a comment. 
Thank you and Regards,
Tharanga Chandrasekara

Thursday, November 24, 2016

Why Codeunit 1530 : "Request Page Parameters Helper" ignores my report filters


Hi,

Last week I was working on a "Customer Statement" Report in Microsoft Dynamics NAV 2017 database. This report was a copy of the original "Statement" (Report 116). Once the modification was done, I simply change the report selection in the Database and then ran the report using Development Environment. 

Applied few filters to the report and it gave the output as I expected. Works perfectly fine! 

After couple of hours, one of my colleague came and inform me that report is not working as expected. His complain was report does not filter the dataset according to the filters set at the request page.

Since the RTC was already open I just thought to run the report to check. I typed the report name and just add a customer filter and click Ok. 

I got totally unexpected result as the output. Report just ran without applying any filters to the dataset. I opened up my development environment and then ran the report from there and then add few filters and click ok. 

Sweet! Report produced the exactly expected output. So what is the misery in here. Change the report selection and put the 116 as the report number (default report) and then ran the report using RTC. It works perfectly fine. 

I design the MenuSuite of the Dynamics NAV 2017 and found that report is called using a codeunit. May be you have seen already, in Microsoft Dynamics NAV MenuSuite, there are some codeunits attached. 



In this scenario, codeunit "Customer Layout - Statement" (8810) handle the report calling.
"Documentation( )// Wrapper codeunit to call 8800 - allows menus and objects to invoke a CU directly to get the per-customer// layout support for statements."
If you went through the code you will see, Report Request page is saved as a XML and then pass it to Codeunit "Request Page Parameters Helper" (1530) to evaluate the filters. 

This is how my report's request page looks like

This is how the "RUNREQUESTPAGE" return XML look's like. 

In the codeunit "Request Page Parameters Helper" (1530), it loop through each XML node and compare it with the Dataset "Table Caption" or "Table Name". 


This is where my new report get into trouble. To confirm my guess I put a message box and execute the report again. 


It result the following message box :
Left side of the equation return the "Document Header" and right side of the equation always return the "Customer". Condition get failed every time and it never go in and SETVIEW. Which result report running without any filters applied. 

From where the "Document Header" come from? 

It is the Name of my Report Dataset (Customer). Default it comes as the "Customer", but we wanted to make it more generic, so we change it to "Document Header". 

If we have several dataitems with same table ID in a report, then report will never going to work with the current logic build in the "Request Page Parameters Helper" codeunit. 


Please provide your feedback with a comment. 
Thank you and Regards,
Tharanga Chandrasekara

Thursday, October 27, 2016

Microsoft Dynamics NAV 2017 - Home Page



Hi Everyone,

I will be posting blog posts about the newly realeased Microsoft Dynamics NAV 2017. This page will be the home page for those blog posts. If you need to know anything specific please post them on the commnet section of the blog post. I will be able to look into those and provide you my view or solution.

Index :
  1. Few more weeks to go : Microsoft Dynamics NAV 2017 & Roadmap
  2. Microsoft Dynamics NAV 2017 - Limited Beta Version Available for Download
  3. What is New in Microsoft Dynamics NAV 2017?
  4. What's New in Microsoft Dynamics NAV 2017​ [Published]
  5. Microsoft Dynamics NAV 2017 - Release Date and new Announcement | Part 01
  6. Microsoft Dynamics NAV 2017 - New Announcement | Part 02
  7. New Release Date : Microsoft Dynamics NAV 2017
  8. Download Microsoft Dynamics NAV 2017
  9. Workflow Wizard with Microsoft Dynamics NAV 2017
  10. New look on List Pages - Microsoft Dynamics NAV 2017
  11. Item Attributes - Microsoft Dynamics NAV 2017 [Comming Soon]
Stay tuned for more information....

Please provide your feedback with a comment. 
Thank you and Regards,
Tharanga Chandrasekara

Wednesday, October 26, 2016

New look on List Pages - Microsoft Dynamics NAV 2017

Microsoft Dynamics NAV 2017 Web Client offers a complete new look for the list pages. 

Webclient comes with sevaral options to change the UI of the list pages. This is something many of client's requested since it will be easy for them to use tile version UI with touch screens. Following are few sample screens from the Microsoft Dynamics NAV 2017 Web Client. 

Item List :

Customer List : 


There are sevaral option of changing the view of the user interface. If you do not like the smaller icons, then how about this :


Or you want to have the old look :

All these are possible with just a click of a button. Just click on the below options form the webclient menu. 

Stay tuned for more information....

Please provide your feedback with a comment. 
Thank you and Regards,
Tharanga Chandrasekara

Workflow Wizard with Microsoft Dynamics NAV 2017

In previous version on Dynamics NAV, we had the option of creating workflows, which was one of the exsiting functionalities. For previoud blog post on Workflows click here

In latest Dynamics NAV 2017 product, Microsoft has taken a extra step to ease the life of partners and users. In new product you can create a workflow using a wizard! Exsiting!! 

If you go to Item Card, you can find this new featuer. 


Click on the "Create Approval Workflow" 


 It will open a Wizard to take you through the workflow setup


You can assign a approver in this window and set up the condition. Once the condifion is set click on next.

In this window will define when the approval workflow will trigger. Check all the condtions are in order and click on next. 

Summary of the created workflow. If you happy with it click on finish and Microsoft Dynamics NAV will activate the workflow for you. 

As per my workflow it should trigger when I change the unit price of the item. Lets give a try! 

When I exit from the item master page after changing the unit price, system trigger the workflow. It works! Item unit price will not change until the new price is approved. 

Stay tuned for more information....

Please provide your feedback with a comment. 
Thank you and Regards,
Tharanga Chandrasekara

Download Microsoft Dynamics NAV 2017


Now you can download Microsoft Dynamics NAV 2017!! Use below link to access the download page: Link


PS: Thanks Freddy for the hot news. 

Please provide your feedback with a comment. 
Thank you and Regards,
Tharanga Chandrasekara

New Release Date : Microsoft Dynamics NAV 2017


Microsoft has announced that they will not be realsing the new Microsoft Dynamics NAV 2017 version till end of this week. To be excat new realses date will be 

28th October 2016. 


Please provide your feedback with a comment. 
Thank you and Regards,
Tharanga Chandrasekara

Wednesday, October 19, 2016

Date Shortcuts in Microsoft Dynamics NAV

I have seen many users are using T when they want to get the Today in the Dynamics NAV, however they do not know thre are few more shortcut keys they can use to ease their life when working with Microsoft Dynamics NAV. 
Following are some of other options available in Microsoft Dynamics NAV related to dates. (In order to below keys to work, field should be a Date Field or Date Filter Field)
  • T - It will return system date (Today)
  • W - It will return the Working Date (Setup in the Dynamics NAV)
Do you want to get the "Days of the Week" ? It also posible with few keyboard key ins. 
  •  M - Monday
  • Tu _Tuesday
  • We - Wednesday 
  • Th - Thursday 
  • F - Friday
If you are working on the weekends, then sorry. You might have to type the dates manually into Dynamics NAV.

Please provide your feedback with a comment.
Thank you and Regards,
Tharanga Chandrasekara

Report color code to identify blank rows

Hi,

If you have been developing RDLC reports for Dynamics NAV, most probably you might have come across the situations where some blank lines are printing in the body of the report and just a glance you cannot identify from where these lines are coming from. 

Very recently one of my colleague asked me to help him with a report. In the report there were couple of blank lines printing and he required a quick help. 

What I normally do is, I use different colors to fill the rows and run the report. It easily help me to find the row which print the blank line. Then rest is simple.. 

Following is an example report which I apply my small trick.


Please provide your feedback with a comment. 
Thank you and Regards,
Tharanga Chandrasekara