OnAfterCreatePurchaseHeader

<< Click to Display Table of Contents >>

Navigation:  Zetadocs SDK Guide > Zetadocs SDK API >

OnAfterCreatePurchaseHeader

OnAfterCreatePurchaseHeader Event

Runs just after 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 OnAfterCreatePurchaseHeader(var onAfterCreatePurchaseHdrHandler: Codeunit "Zdd OnAfterCreatePurchaseHdr")

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

    local procedure OnAfterCreatePurchaseHeader(var onAfterCreatePurchaseHdrHandler: Codeunit "Zdd OnAfterCreatePurchaseHdr")

    begin

    end;

 

Zdd OnAfterCreatePurchaseHdr 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 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 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.

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

 

Syntax

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

 

Parameters

purchHeader

Type: Record "Purchase Header"

The record variable for the current Purchase Header created.

 

GetZdReviewHeader Method

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

 

Syntax

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

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

onAfterCreatePurchaseHeaderHandler.GetZdIsPreview(var isPreview: Boolean)

 

Parameters

isPreview

Type: Boolean

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

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

 

Syntax

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

onAfterCreatePurchaseHeaderHandler.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" } ]