OnAfterGenerateSendResults

<< Click to Display Table of Contents >>

Navigation:  Zetadocs SDK Guide > Zetadocs SDK API >

OnAfterGenerateSendResults

Runs after any Zetadocs System/Customer/Vendor rules have been applied to the email.

Publisher

[IntegrationEvent(false, false)]

 procedure OnAfterGenerateSendResults(var onAfterGenerateSendResultsHandler: Codeunit "Zdd OnAfterGenerateSendResults")

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

 

Zetadocs OnAfterGenerateSendResult codeunit

This codeunit exposes procedures that allow you to modify which template is used for the email as well as who the email is sent to (To,Cc,Bcc). The following methods are currently available on instances of the OnAfterGenerateSendResult data type.

Method name

Description

TrySetTemplate(Code[20])

This method can be used to change the template being used in the email. The function returns a true on successful operations.

SetTemplate(Code[20])

This method can be used to change the template being used in the email.

GetTemplateCode()

This method can be used to retrieve the Template ID currently in use.

TryGetRecordId (var RecordId)

Gets the Business Central record that is currently linked to the email.

GetSkip(var Boolean)

Gets the current "Skip" for the record.

SetSkip(Boolean)

Sets the current "Skip" for the record indicating if the delivery for this record should be skipped.

GetEmailFrom(var Text)

Gets the current email address in the “From” field.

SetEmailFrom(Text)

Sets the current “From” email address.

GetEmailTo(var List of [Text])

Gets the current list of email addresses in the “To” field.

SetEmailTo(List of [Text])

Sets the current “To” email addresses.

GetEmailCc(var List of [Text])

Gets the current list of email addresses in the “Cc” field.

SetEmailCc(List of [Text])

Sets the current “Cc” email addresses.

GetEmailBCc(var List of [Text])

Gets the current list of email addresses in the “BCc” field.

SetEmailBCc(List of [Text])

Sets the current “BCc” email addresses.

GetContactNameTo()

This method will get the current Contact Name used in the Email Template.

SetContactNameTo(Text)

Sets the Contact Name used in the Email Template.

SetDeliveryMethod(Enum ZetadocsDeliveryMethod)

Sets the Delivery method to use.

GetDeliveryMethod() Enum ZetadocsDeliveryMethod

Returns the Delivery Method being used.

SetError(Text)

This method can be used to send a custom error message to Zetadocs Capture and Delivery.

PropagateLastError()

This method will propagate any errors raised in the event subscriber back to Zetadocs Capture and Delivery.

Init(Codeunit "Zetadocs Operation Context"; var codeunit "Zetadocs Customize"; Record "Zetadocs Send Result")

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

 

 

TrySetTemplate Method

This method to change the existing template to another template. Note the template must be uploaded via the Zetadocs Template page first.

Syntax

If (OnAfterGenerateSendResults.TrySetTemplate(templateCode: Code[20])) then…

 

Parameters

templateCode

Type: Text

The template code to be used for the email. This should correspond to the code set in the Zetadocs Template page.

 

SetTemplate Method

This method to change the existing template to another template. Note the template must be uploaded via the Zetadocs Template page first.

Syntax

OnAfterGenerateSendResults.TrySetTemplate(templateCode: Code[20]);

 

Parameters

templatecode

Type: Text

The template code to be used for the email. This should correspond to the code set in the Zetadocs Template page.

 

GetTemplateCode Method

This method can be used to get the current Template being used.

Syntax

templateCode: Code[20]

templateCode := OnAfterGenerateSendResults.GetTemplateCode();

 

TryGetRecordId Method

Gets the Business Central Record Id for the record that is being sent.

 

Syntax

OnAfterGenerateSendResults. TryGetRecordId(var theRecordId: RecordId);

 

Parameters

theRecordId

Type: RecordId

The output variable for the record Id of the document that is being sent.

 

GetSkip Method

This method will return the current skipping status.

Syntax

onAfterGenerateSendResultsHandler.GetSkip(var isToSkip: Boolean);

 

Parameters

isToSkip

Type: Boolean

Pass in a reference for the value to be populated.

 

GetEmailFrom Method

This method will return the current E-Mail sender.

Syntax

onAfterGenerateSendResultsHandler.GetEmailFrom(var emailFrom: Text);

 

Parameters

emailFrom

Type: Text

Pass in a reference for the value to be populated.

 

GetEmailTo Method

This method will return the current list of E-Mail recipient, including those setup in the Zetadocs System or Customer/Vendor Rules for E-Mail To.

Syntax

onAfterGenerateSendResultsHandler.GetEmailTo(var emailList: List of [Text]);

 

Parameters

emailList

Type: List of [Text]

Pass in a reference for the list to populate with the E-Mail To values, the first value will be from the E-Mail To field, the rest from the Additional Recipients setup.

 

GetEmailCc Method

This method will return the current list of E-Mail Cc recipients, including those setup in the Zetadocs System or Customer/Vendor Rules for E-Mail Cc.

Syntax

onAfterGenerateSendResultsHandler.GetEmailCc(var emailList: List of [Text]);

 

Parameters

emailList

Type: List of [Text]

Pass in a reference for the list to populate with the E-Mail Cc values, the first value will be from the E-Mail Cc field, the rest from the Additional Recipients setup.

 

GetEmailBCc Method

This method will return the current list of E-Mail BCc recipients, including those setup in the Zetadocs System or Customer/Vendor Rules for E-Mail BCc.

Syntax

onAfterGenerateSendResultsHandler.GetEmailBCc(var emailList: List of [Text]);

Parameters

emailList

Type: List of [Text]

Pass in a reference for the list to populate with the E-Mail BCc values, the first value will be from the E-Mail BCc field, the rest from the Additional Recipients setup.

 

SetSkip Method

This method will set the current skipping status.

Syntax

onAfterGenerateSendResultsHandler.SetSkip(var isToSkip: Boolean);

 

Parameters

isToSkip

Type: Boolean

Pass in the information for the current record to be skipped or not during the Zetadocs Delivery.

 

SetEmailFrom Method

This method will set the current E-Mail sender.

Syntax

onAfterGenerateSendResultsHandler.SetEmailFrom(var emailFrom: Text);

 

Parameters

emailFrom

Type: Text

Pass in the email to use as the Sender.

 

SetEmailTo Method

This method is used to set the E-Mail To addresses.

Syntax

OnAfterGenerateSendResults.SetEmailTo(emailList: List of [Text]);

 

Parameters

emailList

Type: List of [Text]

A list of valid email addresses to populate the E-Mail To field. The first value will populate the E-Mail To field, any additional addresses will populate the Additional E-Mail To field.

 

SetEmailCc Method

This method is used to set the E-Mail Cc addresses.

Syntax

OnAfterGenerateSendResults.SetEmailCc(emailList: List of [Text]);

 

Parameters

emailList

Type: List of [Text]

A list of valid email addresses to populate the E-Mail Cc field.

 

SetEmailBCc Method

This method is used to set the E-Mail BCc addresses.

Syntax

OnAfterGenerateSendResults.SetEmailBCc (emailList: List of [Text]);

 

Parameters

emailList

Type: List of [Text]

A list of valid email addresses to populate the E-Mail BCc field.

 

SetContactNameTo Method

This method will set the Contact Name displayed in the Zetadocs Delivery Page.

Syntax

OnAfterGenerateSendResults.SetContactNameTo(contactName: Text);

 

Parameters

contactName

Type: Text

The name to display in the Zetadocs Delivery Page. With the default templates this is the name displayed in the email body.

 

GetContactNameTo Method

This method will retrieve the current Contact Name that will be displayed in the Zetadocs Delivery Page.

Syntax

contactName: Text;

contactName := OnAfterGenerateSendResults.GetContactNameTo();

 

SetDeliveryMethod Method

This method will set the Delivery Method to use, this will be reflected in the Zetadocs Delivery Page.

Syntax

OnAfterGenerateSendResults.SetDeliveryMethod(ZetadocsDeliveryMethod::"Hard Copy");

 

Parameters

newDeliveryMethod

Type: Enum ZetadocsDeliveryMethod

The new Delivery Method to use, for example "E-Mail", "Hard Copy".

 

GetDeliveryMethod Method

This method returns the current Delivery Method being used.

Syntax

deliveryMethod := OnAfterGenerateSendResults.GetDeliveryMethod();

 

PropagateLastError Method

This method should be used to push errors that have been raised by Zetadocs Capture and Zetadocs Delivery to declare stop the process execution.

Syntax

OnAfterGenerateSendResults.PropagateLastError();

 

SetError Method

This method is used to pass any custom errors to Zetadocs.

Syntax

OnAfterGenerateSendResults.SetError(errorText: Text);

 

Parameters

errorText

Type: Text

The error message to pass to Zetadocs.

 

Init Method

Initialises the OnAfterGenerateSendResults object with the relevant information. This will be done internally and is not for 3rd parties consumption.