OnBeforeCreatePurchaseHeader

<< Click to Display Table of Contents >>

Navigation:  Zetadocs SDK Guide > Zetadocs SDK API >

OnBeforeCreatePurchaseHeader

OnBeforeCreatePurchaseHeader Event

Runs just before the Purchase Header is created. It provides methods to access and update the Purchase Header and access the Zetadocs Review Header and Lines.

 

Publisher

    [IntegrationEvent(false, false)]

    procedure OnBeforeCreatePurchaseHeader(var onBeforeCreatePurchaseHdrHandler: Codeunit "Zdd OnBeforeCreatePurchaseHdr")

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

    local procedure OnBeforeCreatePurchaseHeader(var onBeforeCreatePurchaseHdrHandler: Codeunit "Zdd OnBeforeCreatePurchaseHdr")

    begin

    end;

 

Zdd OnBeforeCreatePurchaseHdr Codeunit

This codeunit exposes procedures that give you access to the Purchase Header, Zetadocs Review Header and Zetadocs Review Lines.

Method name

Description

GetPurchaseHeader(var purchHeader: Record "Purchase Header")

Returns the Purchase Header, just after it has been initialized and before it has been created.

GetZdReviewHeader(var reviewHeader: Record "Zetadocs ADE Review Header")

Returns the Zetadocs Review Header that was shown on the preview page.

GetZdReviewLines(var reviewLines: Record "Zetadocs ADE Lines")

Returns the Zetadocs Review Lines that were shown on the preview page.

GetZdIsPreview(var isPreview: Boolean)

Returns if the Purchase Record being created is a preview used to check/validate before creating the real Purchase Record. The preview record will be deleted after we've completed the checks.

.SetPurchaseHeader(var purchHeader: Record "Purchase Header")

Overrides the Purchase Header with the data provided.

GetCustomFieldsForReviewHeader(var customFields: JsonArray)

Returns the JsonArray of custom fields from the custom layout for the Zetadocs Review Header.

GetCustomFieldsForReviewLine(headerNo: Guid; lineNo: Integer; var lineCustomFields: JsonArray)

Returns the JsonArray of custom fields from the custom layout for the Zetadocs Review Line.

 

GetPurchaseHeader Method

Will return the Purchase Header, just after it has been initialized and before it has been created.

 

Syntax

onBeforeCreatePurchaseHeaderHandler.GetPurchaseHeader(var purchHeader: Record "Purchase Header")

 

Parameters

purchHeader

Type: Record "Purchase Header"

The record variable for the current Purchase Header being created.

 

GetZdReviewHeader Method

Will return the Zetadocs Review Header that was shown on the preview page.

 

Syntax

onBeforeCreatePurchaseHeaderHandler.GetZdReviewHeader(var reviewHeader: Record "Zetadocs ADE Review Header")

 

Parameters

reviewHeader

Type: Record "Zetadocs ADE Review Header"

The temporary record variable containing the current information of the Zetadocs Review Header shown on the preview page.

 

GetZdReviewLines Method

Will return the Zetadocs Review Lines that were shown on the preview page.

 

Syntax

onBeforeCreatePurchaseHeaderHandler.GetZdReviewLines(var reviewLines: Record "Zetadocs ADE Lines")

 

Parameters

reviewLines

Type: Record "Zetadocs ADE lines"

The temporary record variable containing the current information of the  Zetadocs Review Lines shown on the preview page.

 

GetZdIsPreview Method

Will return if the Purchase Record being created is a preview used to check/validate before creating the real Purchase Record. The preview record will be deleted after we've completed the checks.

 

Syntax

onBeforeCreatePurchaseHeaderHandler.GetZdIsPreview(var isPreview: Boolean)

 

Parameters

isPreview

Type: Boolean

The variable that will return if the Purchase Record being created is a preview used to check/validate before creating the real Purchase Record.

 

SetPurchaseHeader Method

Will overrides the Purchase Header being created with the data provided.

 

Syntax

onBeforeCreatePurchaseHeaderHandler.SetPurchaseHeader(var purchHeader: Record "Purchase Header")

 

Parameters

purchHeader

Type: Record "Purchase Header"

The variable record variable that will update the current information of the Purchase Header.

 

GetCustomFieldsForReviewHeader Method

Will return  the JsonArray of custom fields from the custom layout for the Zetadocs Review Header.

 

Syntax

onBeforeCreatePurchaseHeaderHandler.GetCustomFieldsForReviewHeader(var customFields: JsonArray)

 

Parameters

customFields

Type: Fields

The variable that will return the JsonArray of custom fields for the Zetadocs Review Header.

This will be an array of key/value objects, for example:
[{ "Key": "Vat No", "Value": "GB12345678" }, {"Key": "BankAccount", "Value": "123456" } ]

 

GetCustomFieldsForReviewLine Method

Will return the JsonArray of custom fields from the custom layout for the Zetadocs Review Line.

 

Syntax

onBeforeCreatePurchaseHeaderHandler.GetCustomFieldsForReviewLine(headerNo: Guid; lineNo: Integer; var lineCustomFields: JsonArray))

 

Parameters

headerNo

Type: Guid

The HeaderNo for the Zetadocs Review Header that the Zetadocs Review Line belongs to, that you want to retrieve the custom fields for.

 

lineNo

Type: Integer

The No for the Zetadocs Review Line that the Zetadocs Review Line belongs to, that you want to retrieve the custom fields for.

 

customFields

Type: Fields

The variable that will return the JsonArray of custom fields for the Review Header.

This will be an array of key/value objects, for example:
[{ "Key": "Vat No", "Value": "GB12345678" }, {"Key": "BankAccount", "Value": "123456" } ]