This is the SaaS version to extend the attachment generator. Please refer to Custom Report connector for the on-premise version.
The attachment generator line has two fields that let the user change how the attachment content is generated or modify the attachment content before it attaches. These fields are Generator and Pre-Attach Process. The Generator field is disabled for file attachments, because in that case the user uploads the file content.
Two default generators are available:
Generator | Purpose |
|---|---|
Run Object with scope (Default) | Runs the object chosen using the record ID in scope as a filter. |
Run Object | Runs the object chosen without filtering for the record ID in scope. |
The only option for Pre-Attach Process by default is None, which does nothing.
Prerequisites
The following prerequisites apply:
Experience developing in Microsoft Dynamics 365 Business Central AL.
Basic understanding of Business Integration Solutions.
A development license.
Create a custom generator
Usage
Use this activity when you want to override how the attachment content is generated.
Steps
Create a custom codeunit that implements interface
BISIOnGenerateAttachment.Implement the method
OnGenerateAttachment().codeunit 50000 "EXT Custom Generator" implements BISIOnGenerateAttachment { procedure OnGenerateAttachment(var TempBlob: Codeunit "Temp Blob"; TempAttachmentGeneratorLine: Record "BIS Attachment Generator Line" temporary; RecID: RecordID) var TestOutStream: OutStream; begin TempBlob.CreateOutStream(TestOutStream); TestOutStream.WriteText('Test'); end; }Create an enum extension that extends enum
"BIS Attachment Generator".Add the value to display in the Generator field options and assign the codeunit that implements
BISIOnGenerateAttachment.enumextension 50000 "Ext Attachment Generator" extends "BIS Attachment Generator" { value(50000; ExtGenerator) { Caption = 'Ext Generator'; Implementation = BISIOnGenerateAttachment = "EXT Custom Generator"; } }Ext Generator now appears in the options of the Generator field. Select that option to run the extension function.
Create a custom pre-attach process
Usage
Use this activity when you want to process the attachment content before it attaches.
Steps
Create a custom codeunit that implements interface
BISIOnBeforeAttachToMessage.Implement the method
OnBeforeAttachToMessage().codeunit 50001 "EXT Custom Pre-Attach Process" implements BISIOnBeforeAttachToMessage { procedure OnBeforeAttachToMessage(var TempBlob: Codeunit "Temp Blob"; TempAttachmentGeneratorLine: Record "BIS Attachment Generator Line" temporary; RecID: RecordID) var TestOutStream: OutStream; begin Clear(TempBlob); TempBlob.CreateOutStream(TestOutStream); TestOutStream.WriteText('Test-PreAttach'); end; }Create an enum extension that extends enum
"BIS Attachment Generator".Add the value to display in the Generator field options and assign the codeunit that implements
BISIOnGenerateAttachment.enumextension 50001 "Ext Attach. Pre-Attach Process" extends "BIS Attachment Pre-Attach Process" { value(50000; ExtProcess) { Caption = 'Ext Process'; Implementation = BISIOnBeforeAttachToMessage = "EXT Custom Pre-Attach Process"; } }Ext Process now appears in the options of the Pre-Attach Process field. Select that option to run the extension function.