Wednesday, May 18, 2016


What is AutoSplitKey??
According to the MSDN, AutoSplitKey is defined as,
Sets whether a key is automatically created for a new record placed between the current record and the previous record.
This means when you enter a record in between two records, Dynamics NAV will split the last field of the primary key group and create a new value and assign to the newly created record. 
As an example if the user want to enter records between line 10000 and 20000 then system will split the line no (last primary key) as below. 

This is mainly used in the line tables where combination (concatenate) of fields been used as primary keys. 
If not for the inbuilt AutoSplitKey function in Dynamics NAV, developers will have to handle the auto split key option in the development level (with code level), which will be a headache in the production environment. 

Luckily the AutoSplitKey function is an in-built option and following are the main conditions must met to use the AutoSplitKey :
Let's just check how to set it..
As an example let's get the "Sales Line" (37) table and see how the primary key is been set. To do that just follow the steps according to the image below. 

Primary key of the "Sales Line" table : "Document Type,Document No.,Line No.". 
Last field of the primary key is set an integer and it fulfill the criteria required to use "AutoSplitKey" function.    

As the next step, open the properties of the page "Sales Invoice Subform" (47) using development environment. In the properties, go to AutoSplitKey and check the set parameter of it. In the "Sales Invoice Subform" it has been set to yes, which means key will get split automatically if the user will try to enter a line in between a record. 

Let's see how it works,
Hope above image does cover the practical aspect of the AutoSplitKey. 

Can you guess how many lines can be added in between two (02) records in Dynamics NAV? Just check my next blog post to get the answer on the question. 

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


  1. Hello :) Thank you for this tutorial and step-by-step explanations, it was very helpful for me to understand what AutoSplitKey is and how I can use it.