Please enable JavaScript to view this site.

 

Navigation: Zetadocs Expenses SDK Guide > SDK API

OnAfterCreatePurchaseHeader

Scroll Prev Top Next More

OnAfterCreatePurchaseHeader Event 

This event will allow you to make amendments to the Purchase Header after it has been created by the export process.

Publisher

[IntegrationEvent(false, false)]

procedure OnAfterCreatePurchaseHeader(var onAfterCreatePurchaseHeader: Codeunit "Zde OnAfter 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", 'OnAfterCreatePurchaseHeader', '', true, true)]

 

Zde OnAfter Create Purch. Hdr codeunit

This codeunit exposes procedures that allow you to update purchase invoice header values after the standard process has completed, as well as giving access to the expenses export data. The following methods are currently available on instances of the OnAfterCreatePurchaseHeader data type.

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

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

Allows setting of a custom error message.

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

 

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 Purchase Header that has been created.

UpdatePurchaseHeader (purchaseHeader: Record "Purchase Header")

Updates the Purchase Header with the provided data.

TryUpdatePurchaseHeader (purchaseHeader: Record "Purchase Header"): Boolean

Updates the Purchase Header with the provided data, returns the result of the operation as a Boolean.

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

onAfterCreatePurchaseHeader. 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

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

 

Parameters

purchaseHeader

Type: Record "Purchase Header"

Purchase Header created in export process. Contains all data populated in process.

 

UpdatePurchaseHeader Method

Provides a way to set new values into the Purchase Header. An error is thrown if an operational error is encountered when running this method.

 

Syntax

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

 

Parameters

purchaseHeader

Type: Record "Purchase Header"

Purchase Header modification to update.

 

TryUpdatePurchaseHeader Method

Provides a way to set new values into the Purchase Header. In this method, if an operational error is encountered, a Boolean is returned.

 

Syntax

onAfterCreatePurchaseHeader. TryUpdatePurchaseHeader(purchaseHeader: Record "Purchase Header");

 

Parameters

purchaseHeader

Type: Record "Purchase Header"

Purchase Header modification to update.

Returns

True if execution was successful, false if error occurred.

 

SetError Method

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

 

Syntax

onAfterCreatePurchaseHeader.SetError(errorMessage: Text);

 

Parameters

errorMessage

Type: Text

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