When a dataport runs in Microsoft Dynamics NAV, certain triggers execute to update the database.

Triggers on Dataports

The following table lists triggers that execute when a dataport runs.

Trigger Time of execution

OnInitDataPort Trigger

When the dataport is loaded, and before the request form is run and table views and filters are set.

OnPreDataPort Trigger

Before the dataport is run, but after the request form has been run. Table views and filters are set when this trigger is run.

OnPostDataPort Trigger

After all the data items have been processed.

OnPreDataItem Trigger

Before the data item is processed, but after the associated variable has been initialized and the table views and filters set.

OnBeforeExportRecord Trigger

When a record has been retrieved and is ready for export.

OnAfterExportRecord Trigger

After a record has been exported to the external file.

You can use this trigger, for example, to do some processing on the external file before the next record is exported, such as moving the file pointer.

OnBeforeImportRecord Trigger

Before a record is imported from the external file.

You can use this trigger, for example, to do some processing on the external file before importing the next record, such as moving the file pointer.

OnAfterImportRecord Trigger

After a record has been imported from the external file, but before it is inserted in the table.

You can use this trigger, for example, to process the record before inserting it or to examine it in order to decide whether to insert it.

OnPostDataItem Trigger

When the data item has been iterated for the last time.

OnAfterFormatField Trigger

After the value of a field has been formatted, but before the text is written to the external file. This trigger gives you access to the formatted value in its text format.

OnBeforeEvaluateField Trigger

After a field has been read from the external file, but before the value has been evaluated and validated. This trigger gives you access to the imported field in text format.

See Also