Before an expense item is processed, this event will allow you to set the initial data for the General Journal Lines.
Publisher
[IntegrationEvent(false, false)]
procedure OnBeforeCreateJournalLine(var onBeforeCreateJournalLine: Codeunit "Zde OnBefore Create Jnl. Line")
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", 'OnBeforeCreateJournalLine', '', true, true)]
This codeunit exposes procedures that allow for Journal Line values to be preopoulated prior to the standard processing takes place, as well as giving access to the expenses export data. The following methods are currently available on instances of the OnBeforeCreateJournalLine data type.
Method name |
Description |
---|---|
GetExpensesExportData (var exportData: Codeunit "Zde Export Data Integration") |
Returns the Expense Export Data for the expense item that is about to be processed. |
GetGLJournalLine (var journalLine: Record "Gen. Journal Line") |
Returns the current General Journal Line. |
UpdateGLJournalLine (journalLine: Record "Gen. Journal Line") |
Sets new data into the General Journal Line. |
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. |
Provides a way to retrieve Expense Data for the current expense item from the Export Bundle.
Syntax
onBeforeCreateJournalLine. GetExpensesExportData (var exportData: Codeunit "Zde Export Data Integration");
Parameter
exportData
Type: Codeunit "Zde Export Data Integration"
This codeunit gives you read access to all the values for the current expense.
Provides a way to retrieve the General Journal Line that is currently set.
Syntax
onBeforeCreateJournalLine. GetGLJournalLine(var journalLine: Record "Gen. Journal Line");
Parameter
journalLine
Type: Record "Gen. Journal Line"
General Journal Line before it is processed by the standard logic. Does not contain any data at this stage (Unless it has previously been set by the UpdateGLJournalLine method). For an expense item with part of the amount being taxable it will be the taxable part. For taxable expense it will be taxable amount. For a non-taxable expense item, it will be the non-taxable amount. For a final report adjustment it will be the adjustment’s non-taxable amount.
Provides a way to set the General Journal Line with updated information.
Syntax
onBeforeCreateJournalLine. UpdateGLJournalLine(journalLine: Record "Gen. Journal Line");
Parameter
journalLine
Type: Record "Gen. Journal Line"
General Journal Line used later in export process.
Use this method to set custom error messages that will be populated in the Expense Report.
Syntax
onBeforeCreateJournalLine.SetError(errorMessage: Text);
Parameters
errorMessage
Type: Text
The error message to display to the user in the Export Report.