官术网_书友最值得收藏!

Triggers

In Computer Science, a trigger is a method that commences an action when an event which is related to it occurs. In general, the events resemble key-press events, mouse events, and automatic events from a timer. But here, we are dealing with events that are directly or indirectly relevant to the database fetch or push operations like insert, delete, modify, and so on. There are the following three kinds of triggers in Microsoft Dynamics NAV:

  • Documentation triggers
  • Event triggers
  • Function triggers

Documentation triggers

These are actually not triggers; these are used to write documentation for a particular object. Many developers use this space to document their modifications to standard objects. Every object has a documentation trigger. The code written in this trigger is eliminated in the section of code optimization of the compiler, and no code written in this section actually runs:

Documentation triggers

Event triggers

Event triggers are the most commonly used triggers. These triggers take action when any events are set. They always start with the word On, such as OnRUN, OnInsert, OnDelete, and the like. We can write code in all of the triggers. For event triggers, the code runs when the event related to it occurs. For example, the code in the OnRun event trigger is executed when a codeunit that contains the trigger is run. Other examples are shown in the following screenshot:

Event triggers

Function triggers

Function triggers are the triggers which are created automatically when the function is defined in the C/AL Global window. The C/AL code can be written in the Trigger section, and is executed when the function is called.

The following triggers are available for different objects in Microsoft Dynamics NAV 2016:

  • Report and data item triggers
  • Table and field triggers
  • XMLport triggers
  • Page and action triggers
  • Codeunit triggers
  • Query triggers
主站蜘蛛池模板: 墨江| 延安市| 双桥区| 宝坻区| 枞阳县| 潼关县| 新兴县| 绍兴县| 贵南县| 盐源县| 台州市| 科技| 南岸区| 屯门区| 南昌县| 普安县| 嘉兴市| 全南县| 大埔县| 科技| 宿松县| 荆州市| 灵台县| 枝江市| 会昌县| 浮山县| 连江县| 建阳市| 应城市| 淄博市| 万安县| 集安市| 梨树县| 汾阳市| 攀枝花市| 乐昌市| 平武县| 高要市| 武定县| 宜城市| 元氏县|