Monday 25 August 2014

Dynamics NAV in C# | Part 1 | The Differences

Before you start working on C# as a Dynamics NAV developer, or as some call us Dinosaur, you need to be aware of the differences in approach.

Database driven development

In Dynamics NAV we are used to develop in a “database”. This used to be a native “fdb” file in the old days and nowadays it’s a SQL Server database. The development we do is a combination of coding and defining metadata.

More than one developer can work in the same database and we can move parts of our code from one system to another using binary files we call “fob”.

File driven development

When working on a piece of C# code in Visual Studio you’ll probably work in what they call a “project” or “solution”. This is usually a folder somewhere on your drive with a bunch of files. To start working on a solution you have to open the “.sln” file which will give visual studio the information it needs. In the simples scenario where you develop a piece of C# code for Dynamics NAV your solution will have a “.cs” file that contains the actual C# code. You can compare this file to a Code Unit in Dyanamics NAV. Visual Studio will also generate a bunch of other files that you can ignore for now.

Compiling

Compiling in Dynamics NAV is called Build in Visual Studio. Both features check the code for errors and generate “stuff”. The stuff in Dynamics NAV is (funny enough) generating the C# from the C/AL and binding it into the other objects. The stuff in Visual Studio is generating the DLL file that you will use in Dynamics NAV as a DotNet library.

Versioning
Both Dynamics NAV and Visual Studio do not offer object versioning by default.

Team Foundation Server

When working together on a larger Visual Studio C# project you can use TFS, or Visual Studio Online to manage tasks and versions of your C# files.

TFS is text based, like Visual Studio and does not understand the structure of Dynamics NAV and its binary objects that are stored in a SQL Server Database.

You can use TFS manually with the Text files you can export from Dynamics NAV, but there is no automatic interface. There are some third party tools that provide help with that.

Let’s get started: “Hello World”

So having explained the differences, let’s start working on a very simple C# project. We will start with a good old “Console Project”.

After having started Visual Studio we will generate a new project like this:


CSharpNAVEx1Image1

And then we get “the list” that confuses most people that get started with Visual Studio and makes you unsure.

CSharpNAVEx1Image2

Lets discuss what we see here

On the right there is a bunch of templates. Ignore everything you see here and only go to Visual C# and Windows. Within this menu we have three types of projects that we will use in this series: Console Application, Windows Forms Application and Class Library. We will now choose “Console Application”.

On top we can choose the version of DotNet we want to use. Dynamics NAV uses 4.5 so we know that our users will have that installed and can go ahead and use this version.

Then we can select a name and location for our project. We choose “Hello World” and leave the folder to default.

On the far right bottom you can see the “golden” option “Add to source control” which will register the solution on TFS or Visual Studio Online system. We will not do that for this example.

The “main” function

When Visual Studio has generated the project we get this window:

CSharpNAVEx1Image3

Let’s talk through them

First we see a bunch of “using” lines. These are the DotNet libraries that will be used by this project, which can be compared by using Code Units in Dynamics NAV that contain functions you use accross the application, if you don’t define the Code Unit you cannot use the function. We’ll get back to that later in the series.

Then we see the namespace of our project. You can compare this to the Add-On number bands in Dynamics NAV, every project or customer get’s their own Namespace. During our series we will not change the namespaces, just leave it as it is.

Within the namespace we see a class. This can be compared to a object in Dynamics NAV, a logical group of code or features. You can put everything in one class like in a Code Unit but that would not be maintainable

Lastly we see what is most important

static void Main(string[] args)

This is a function. It is very important to understand the syntax of a function. Unlike Dynamics NAV where we define functions as metadata we can define functions in C# by just typing in new text. We can break down this line into four parts

static

This defines how the function can be used. We will need this when we start working on DLL files that we use in NAV. Functions can be Static, Public Private. Comparable to using local functions in Dynamics NAV or Single Instance codeunits.

void

This is the return value. Void means no return value. Like Dynamics NAV a function can only have one return value

Main

This is the function name. Main is a reserved name that can be compared with Codeunit 1 in Dynamics NAV. The program starts here and always passes this code.

(string[] args)

These are the parameters of the function. In this case the function accepts an array ([] means array) of strings.

Hello World

Now that we know what we see here we can add some code to our function Main and test if it runs.
Since we have a console application we can write to the console. Lets add these lines:

CSharpNAVEx1Image4

Console is a variable we can use like DIALOG in Dynamics NAV. This will display “Hello World” and wait for user input.

Console.ReadKey(); 

Please note that even though we are not passing values to the ReadKey we still have to provide the (). When you start writing C# this will make you go bananas and if you forget them you get a really weird error like this:

CSharpNAVEx1Image5

So never forget them!

Let’s run the thing alright!

CSharpNAVEx1Image6

This is what you get when you press the Start button.

Congratulations you have just created your very first C# application and learned about a lot of differences between Dynamics NAV and Visual Studio.

**Reference taken from the original post  of Mark Brummel.

Regards,
Sathish
http://sathish-nav.blogspot.com

Saturday 23 August 2014

News From Microsoft Desk...



Hi All,

While Browsing Partner Source and Microsoft Team Blog i found out some interesting link and thought of sharing them.

Below are some updates from Microsoft on Team Blog -



1. Filter values specified on a request page for a report are not saved by the Web Client

This article says that its a limitation of web client that the values are not saved in Report Request Page as it happens in Role Tailored Client. The Link provides the Updated Limitation of Web Client in NAV 2013 R2.

Read Complete Article on Microsoft Team Blog.

2. Temporary Issue with Single Sign-On for Office 365

On August 13, the Single Sign-On (SSO) protocol that is used in Microsoft Azure Active Directory (Azure AD) was updated, which unfortunately caused the SSO implementation in Microsoft Dynamics NAV 2013 R2 to fail temporarily. As a result, users could not log into Microsoft Dynamics NAV using their Office 365 credentials.The problem was resolved. The new design will be part of the Cumulative Update 11 for Microsoft Dynamics NAV 2013 R2. 

Read Complete Article on Microsoft Team Blog.

3. Compatibility with SQL Server 2014

Microsoft Dynamics NAV 2013, Microsoft Dynamics NAV 2013 R2, and Microsoft Dynamics NAV 2009 R2 are compatible with SQL Server 2014!

Please note that this applies to the following editions of Microsoft SQL Server:
Standard Edition

Enterprise Edition

Read Complete Article on Microsoft Team Blog.

4. Announcement about Tax Updates Dependent on Cumulative Updates (CU) in Microsoft Dynamics NAV

Effective July 15, 2014, all Tax Updates (commonly referred to as Regulatory Features) will be developed based on the latest Cumulative Updates as their baseline instead of the current practice of basing the same on an RTM release.

Effective October 1, 2014, all Tax Updates for Microsoft Dynamics NAV will be developed on CU and will be released only through Cumulative Updates. Microsoft Dynamics NAV will no longer release individual .fob or text files for a Tax Update.

Read Complete Article on Microsoft Team Blog.

Hope you find the information useful.




Regards,
Sathish
http://sathish-nav.blogspot.com

Thursday 21 August 2014

NAV 2013 - Platform Issues Resolved in the Cumulative Update17 Released



Hi all,

Please find below the details of Cumulative Update 17 released for Microsoft Dynamics NAV 2013.


Title - Cumulative update 17 for Microsoft Dynamics NAV 2013 

Build No. - 37532
Release Date - August, 2014
Local Version Included - AU, AT, BE, CH, DE, DK, ES, FI, FR, IS,
IT, NA, NL, NO, NZ, SE, UK


Download Link



Platform Issues Resolved in the Cumulative Update are -
  • Bad performance when the lookup page contains a long text column and it is used as the default filter.
  • The Close button does not work when you try to close the Find in View - Posted Purchase Receipt Lines page.
  • The win client crashes if you use Filter as You Type and you have set the display size to 125% in the Control Panel.
  • Customizing the ribbon permanently hides an action.
  • Delete in tree view deletes non-selected records.
  • FlowFields with mixed SQL Data type work in an unexpected way.
  • A PLLP partner has an issue with language and the Excel add-in.

For information about previous Update Rollup / Cumulative update released for Microsoft Dynamics NAV 2013 Please Navigate to Hotfix Label or follow the Link.

All These links required valid Partner Source / Customer Source Login...


Regards,
Sathish
http://sathish-nav.blogspot.com

NAV 2013 R2 - Platform Issues Resolved in the Cumulative Update 10



Hi all,

Please find below the details of  Cumulative Update 10 released for Microsoft Dynamics NAV 2013 R2.

Title - Cumulative Update 10 for Microsoft Dynamics NAV 2013 R2


Build No. - 37534
Release Date - August, 2014
Local Version Included - AU, AT, BE, CH, DE, DK, ES, FI, FR, IS, IT, NA, NL, NO, NZ, SE, UK, RU


Download Link



Note: Implementing this cumulative update will require a database conversion unless you have already implemented update rollup 5.



License Versioning -

Microsoft Dynamics NAV 2013 R2 Cumulative Update 10 introduces license key versioning to Microsoft Dynamics NAV. Observe the following specifications:

Microsoft Dynamics NAV 2013 R2 license keys will continue to be backward compatible with Microsoft Dynamics NAV 2013 instances.
Microsoft Dynamics NAV 2013 license keys cannot not be used with Microsoft Dynamics NAV 2013 R2 instances. Accordingly, newly issued Microsoft Dynamics NAV 2013 license keys will not work with Microsoft Dynamics NAV 2013 R2 CU10 (or later) instances.
Microsoft Dynamics NAV 2013 and Microsoft Dynamics NAV 2013 R2 license keys are not forward compatible with Microsoft Dynamics NAV 2015 instances.

Platform Issues Resolved in the Cumulative Update are -
------------------------------------------------------------------------------------------------------
  • The Show as Chart function crashes the client if you run it from the Job Ledger Entries page for a specific job.
  • Customizing the ribbon permanently hides an action.
  • The cursor jumps to a random record after validate error.
  • Delete in tree view deletes non-selected records.
  • System.IndexOutOfRangeException when running multiple NAV Servers.
  • The client crashes with a filter exception on a FactBox.
  • The web client shows error and cannot be closed.
  • If you try to add a record via OData using a page that does not include all of the primary key fields, you will encounter an error message referring to missing values.
  • Export to excel using an add-in fails.
  • If you drill down on a FlowField value, you may not see the expected underlying records.
  • Cannot export/import upgraded database.
  • When you use the FORMAT() function, the results can be different compared to previous release as it does not consider decimal places property correctly if these are defined at table level.
  • When you export to Excel using a PLLP language release, the language changes back to English on a client OS.
  • Cannot modify system tables by import objects from command prompt.
  • Cannot import objects.
  • When you import a fob file in builds > 7.1.36703, a list of errors is no longer shown.
  • Integration Management does not support multitenancy.
  • The web client crashes application pool when specifying a non-existing tenant ID.
  • QuickEntry does not work when a field is also in IndentationControls.
  • The license should check that it is compatible with NAV 2013 R2.
  • The program version for NAV 2013 R2 is incorrect.
  • TAB and ENTER give different results when running code from the OnValidate() trigger.
  • "Microsoft Dynamics NAV internal-only exception used to implement control statements Skip, Break, and Quit in Reports and XMLport." error message from NAS Services.
  • The win client crashes if you use Filter as You Type and you have set the display size to 125% in the Control Panel.
  • FlowFields with mixed SQL Data Type work in an unexpected way.
  • ISEMPTY leaks memory.
  • Problems using new database with imported application objects.
  • NAV crashes with server-side dotnet variables.
  • Bad performance when the lookup page contains a long text column and it is used as default filter.
  • Move disabled fields from About This Page to a separate FactBox.
  • SETSELECTIONFILTER does not work when only one line is marked.
  • The Delete function returns a wrong reference after a previous deletion was canceled, potentially causing the wrong entries to be deleted without notice.
  • Integer dataitem breaks security filter.
  • "Queries between data sources are not supported" error message from query object when used with Access Control and Permission tables (Data per Company = No).
  • If a security filter is applied to a permission set then all users experience strange permission errors even though the security filter was applied to their permission set.

-------------------------------------------------------------------------------------------------------

For information about previous Update Rollup / Cumulative update released for Microsoft Dynamics NAV 2013 Please Navigate to Hotfix Label or follow the Link.

All These links required valid Partner Source / Customer Source Login...


Regards,
Sathish
http://sathish-nav.blogspot.com

Wednesday 20 August 2014

Cumulative Update 17 for Microsoft Dynamics NAV 2013 has been released



Cumulative update 17 includes all application and platform hotfixes and regulatory features that have been released for Microsoft Dynamics NAV 2013.

The cumulative update includes hotfixes that apply to all countries and hotfixes specific to the following local versions: 

     *   AU - Australia
     *   AT - Austria
     *   BE - Belgium
     *   CH - Switzerland
     *   DE - Germany
     *   DK - Denmark
     *   ES - Spain
     *   FI   - Finland
     *   FR - France
     *   IS  - Iceland
     *   IT   - Italy
     *   NA - North America
     *   NL - Netherlands
     *   NO - Norway
     *   NZ - New Zealand
     *   SE - Sweden
     *   UK - United Kingdom

Where to find cumulative update 17

You can download cumulative update 17 from KB 2984829 - Cumulative Update 17 for Microsoft Dynamics NAV 2013 (Build 37532).

For a full list of all hotfixes included in cumulative updates for Microsoft Dynamics NAV 2013, see the following CustomerSource and PartnerSource pages:

CustomerSource:

     *  Overview of Released Application Hotfixes for Microsoft Dynamics NAV 2013
     *  Overview of Released Platform Hotfixes for Microsoft Dynamics NAV 2013

PartnerSource:

     *   Overview of Released Application Hotfixes for Microsoft Dynamics NAV 2013
     *  Overview of Released Platform Hotfixes for Microsoft Dynamics NAV 2013

More Information

For a list of all released cumulative updates, see Released Cumulative Updates for Microsoft Dynamics NAV 2013.

Regards,
Sathish
http://sathish-nav.blogspot.com