Please enable JavaScript to view this site.

 

Navigation: Zetadocs Expenses SDK Guide > SDK API

OnBeforeCreatePurchaseHeader

Scroll Prev Top Next More

OnBeforeCreatePurchaseHeader Event 

Before the Purchase Header for a purchase invoice record is created, this event will allow you to set some data for the Purchase Header before the standard processing is performed.

Publisher

[IntegrationEvent(false, false)]

procedure OnBeforeCreatePurchaseHeader(var onBeforeCreatePurchaseHeader: Codeunit "Zde OnBefore Create Purch. Hdr")

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", 'OnBeforeCreatePurchaseHeader', '', true, true)]

 

Zde OnBefore Create Purch. Hdr codeunit

This codeunit exposes procedures that allow you to prepopulate Purchase Header values before standard processing is performed , as well as giving access to the expenses export data. The following methods are currently available on instances of the OnBeforeCreatePurchaseHeader data type.

 

Method name 

Description 

GetExpensesExportData (var exportData: Codeunit "Zde Export Data Integration")

Returns the expenses export data for the first expense item in the export data bundle.

GetPurchaseHeader (var purchaseHeader: Record "Purchase Header")

Returns the currently set Purchase Header that will be used later in the export process.

UpdatePurchaseHeader (purchaseHeader: Record "Purchase Header")

Sets the Purchase Header to be used later in the export process.

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.

 

GetExpensesExportData Method

Provides a way to get the expenses export data for the first expense item in the export data bundle.

 

Syntax

onBeforeCreatePurchaseHeader. GetExpensesExportData (var exportData: Codeunit "Zde Export Data Integration");

 

Parameters

exportData

Type: Codeunit "Zde Export Data Integration"

This codeunit gives you read access to all the values in the first expense.

 

GetPurchaseHeader Method

Provides a way to retrieve the currently set Purchase Header

 

Syntax

onBeforeCreatePurchaseHeader. GetPurchaseHeader(var purchaseHeader: Record "Purchase Header");

 

Parameters

purchaseHeader

Type: Record "Purchase Header"

Purchase Header used later in the export process. Does not contain any data at this stage, unless the UpdatePurchaseHeader method has been called prior.

 

UpdatePurchaseHeader Method

Provides a way to set new values into the Purchase Header.

 

Syntax

onBeforeCreatePurchaseHeader. UpdatePurchaseHeader(purchaseHeader: Record "Purchase Header");

 

Parameters

purchaseHeader

Type: Record "Purchase Header"

Purchase Header used later in export process.

 

SetError Method

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

 

Syntax

onBeforeCreatePurchaseHeader.SetError(errorMessage: Text);

 

Parameters

errorMessage

Type: Text

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