Please enable JavaScript to view this site.

 

OnAfterExport Event 

This event occurs after the Export has run, if no errors were encountered then the expense(s) have been committed to the database. 

Publisher 

[IntegrationEvent(false, false)]

procedure OnAfterExport(var onAfterExportHandler: Codeunit "Zde OnAfter Expenses Export")

begin

end;

 

Subscriber 

To subscribe to this event, you will need to decorate the subscriber method with the correct EventSubscriber attributes: 

[EventSubscriber(ObjectType::Codeunit, Codeunit::"Zetadocs Expenses Customize", 'OnAfterExport', '', true, true)] 

 

Method name 

Description 

TryGetExportType (var ExportType: Enum ZdeExportType): Boolean 

Returns the Export Type for this expense. 

GetGeneratedRecords (var GeneratedRecords: List of [RecordId]) 

Gets a list of generated records in Business Central 

SetError (errorMessage: Text) 

Allows setting of a custom error message. 

Init() 

This method is called internally by the publisher, a call to this method will return an error. 

 

TryGetExportType Method 

Provides a way to get the Export Type for this Expense Export, i.e. whether it is a Journal or Purchase Invoice being generated. 

 

Syntax

onAfterExportHandler.TryGetExportType(var exportType: Enum ZdeExportType) 

 

Parameters

exportType 

Type: Enum ZdeExportType 

Returns the Expenses Export Type of the Export. 

 

GetGeneratedRecords Method 

Provides a way to retrieve the records that have been generated in Business Central by the export process.

 

Syntax

onAfterExportHandler.GetGeneratedRecords(var GeneratedRecords: List of [RecordId]); 

 

Parameters

GeneratedRecords 

Type: List of [RecordId]

List of RecordIds that have been created. 

 

SetError Method 

Use this method to set custom error messages that will be populated in the Expense Report. 

 

Syntax

onAfterExportHandler.SetError(errorMessage: Text); 

 

Parameters

errorMessage

Type: Text

The error message to display to the user in the Export Report.