Tuesday 3 November 2015

NAV 2016 Events

Hi,

Many of would have already heard about the EVENTS in NAV2016 in this post let me show a simple example of how to use them.



What are Events?


C/AL programming is now made more flexible and effortless to upgrade, the programming concept of EVENTS has been introduced.

EVENTS permits developers to add additional functionality without modifying the source code.


Events in code level:

  • Business Events
  • Integration Events
  • System Events


Events raised by the platform:

  • Table Trigger Events
  • Page Trigger Events



In this post let me demonstrate Table Trigger Events.

In Dynamics NAV 2016 every table will have the below events created by default once you create table.

Table Level :                 
  • OnInsert                
  • OnDelete
  • OnRename
  • OnModify 
Field Level :
  • OnAfterValidate
  • OnBeforeValidate



Let us see how to use it with an example.

Scenario : Vendor creation should be done only by specific USER in Dynamics NAV.

  • Create a CodeUnit 

  • Create a new function in the code unit.

  • Change the properties of the Function as below.

  • Now add a little bit of code here in the Function and save it.




  • Open the Vendor Card and try to create new vendor.
  • System will not allow you to create a new vendor.
This is how events work. 

Earlier we used to write code in the Triggers in which we used to modify source code. 

But now with EVENTS we can avoid customizing base object to the maximum extend.

This will make life easy for developers in merging objects, up-gradation etc...

Cheers...








 

4 comments: