Tip #14 – Autoincrement Interaction Log Entries

Tip #14 – Autoincrement Interaction Log Entries

Interaction Log entries are a very powerfull feature of Dynamics NAV. From everywhere in NAV you can add an interaction log entry if you print a report and from withing the CRM part of NAV you can register all other interactions like emails, phonecalls, mailings etc.

Interactions can be related to a path of multiple to-do’s that can be sinchronised with Outlook.

Technicaly the interaction log entry table is clustered by an entry no. Like al Entry tables in NAV this handled manualy by C/AL code. This means that every time someone creates a new interaction log entry, the last record in the table is locked, thus isolating all transactions creating a new record.

SQL Server can also maintain the entry number for you. This is built in technilogy called Identity Insert.

To activate this feature for a NAV table change the property Auto Increment of the field.

Every table can have one field with this feature. This can be (part of) the primairy key or not.

If you enable this field you will encounter two typical issues. The first issue you will notice is that if you create a new entry the value of the autoincrement field has to be set to zero. The other issue is that if an error occurs during the transaction, the entry number will be skipped, leading to gaps in the numbering.

If the latter is not a functional issue then the first can be solved by rewriting some code. For Interaction log entries this is just two places. I will let you figure out those places yourself.