REFRACT Platform for Dynamics 365 Business Central

Event & Payload Reference - VaultPDF Business Central

Complete integration event reference for all 22 VaultPDF AL events, plus the full dispatcher payload structure with all fields documented.

Dispatcher Payload Reference

The payload sent to the Dispatcher has the following structure. The templateSettings object is omitted entirely when no settings are configured on the template.

{
  "templatePath": "SourceSystem/Module/templateId",
  "payloadPath": "SourceSystem/Module/DOC001_MYTEMPLATE.json",
  "options": {
    "documentId": "DOC001",
    "docType": "SalesOrder",
    "generatedBy": "PADMA",
    "sourceSystem": "RefractLogic",
    "customColumns": {},
    "features": {
      "generatedDocuments": true
    }
  },
  "templateSettings": {
    "watermark": {
      "enabled": true,
      "value": "CONFIDENTIAL"
    },
    "distribution": {
      "enabled": true,
      "approversEmail": "approver@example.com"
    },
    "delivery": {
      "recipients": [
        {
          "email": "r@example.com",
          "displayName": "Recipient Name"
        }
      ]
    },
    "esign": {
      "enabled": true,
      "signingMode": "sequential",
      "expiresInMinutes": 10080,
      "signers": [
        {
          "slotIndex": 1,
          "role": "Signer",
          "email": "s@example.com",
          "namePrefill": "John Doe"
        }
      ]
    },
    "approvalPanel": {
      "user": "approver-id"
    },
    "workflow": {
      "enabled": true,
      "recipients": [
        {
          "email": "r@example.com",
          "displayName": "Reviewer"
        }
      ],
      "message": "You have been invited to review document DOC001."
    }
  }
}

Payload Fields

FieldTypeDescription
templatePathstringFull path to the template definition in SharePoint: {SourceSystem}/{Module}/{TemplateId}
payloadPathstringFull path to the payload JSON stored in SharePoint: {SourceSystem}/{Module}/{DocumentId}_{TemplateId}.json
options.documentIdstringUnique identifier for this document. Used in the PDF filename and audit logs
options.docTypestringSource document type, e.g. SalesOrder, PurchaseInvoice
options.generatedBystringSystem that generated the request, e.g. PADMA (Business Central)
options.sourceSystemstringRoot folder name from VAULTPDF_SOURCE_SYSTEM setting. Omitted when the setting is empty
templateSettingsobjectRouting, workflow, and delivery configuration (omitted if not configured)

templateSettings Fields

FieldTypeDescription
watermark.enabledbooleanPrint a watermark on the PDF
watermark.valuestringWatermark text, e.g. CONFIDENTIAL
distribution.enabledbooleanActivate document delivery routing
distribution.approversEmailstringApprover email (token-resolved at dispatch time)
delivery.recipientsarrayEmail recipients for direct delivery
esign.enabledbooleanRoute PDF to signers after generation
esign.signingModestringsequential or parallel
esign.expiresInMinutesintegerSigning link validity period (0 = Dispatcher default, 7 days)
esign.signersarrayOrdered list of signers with slotIndex, role, email, namePrefill
approvalPanel.userstringApproval panel user identifier
workflow.enabledbooleanTrigger a REFRACT Platform approval workflow
workflow.recipientsarrayWorkflow notification recipients
workflow.messagestringMessage body sent to workflow recipients (token-resolved)

Inspect the live payload

Use the Sample Request action on the Template Card (search VaultPDF Templates → open a template → Sample Request) to see the exact JSON that would be sent for that template with all configured settings, without generating a real document.


Complete Integration Event Reference

All integration events published by VaultPDF, grouped by codeunit. All use [IntegrationEvent(false, false)]. Events marked IsHandled support override - set IsHandled := true to skip the default behaviour. See the Developer Guide for full signatures and code examples for each event.

EventCodeunitIDIsHandledPurpose
OnBeforeGetDefaultLinesTableIdVaultPDF Template Header77100YesOverride lines table auto-detection for custom header/lines document structures
OnBeforeFindParentFieldIdVaultPDF Template Header77100YesOverride the field ID linking a lines table to its parent header when the default convention-based lookup does not apply
OnBeforeBuildJsonVaultPDF JSON Builder-YesReplace the JSON payload entirely before field mapping runs
OnAfterBuildJsonVaultPDF JSON Builder-NoTransform JSON after field mapping; inject additional fields
OnFormatFieldVaultPDF JSON Builder-YesOverride how a specific field value is serialised (e.g. custom date format, enum label)
OnBeforeAddFieldVaultPDF JSON Builder-YesSkip or rename a field before it is written to the JSON object
OnResolveQuerySectionVaultPDF JSON Builder-YesInject a Query-backed JSON section into the payload
OnBeforeGetDefaultFolderNameVaultPDF Dispatcher77119YesOverride the PDF storage folder name in SharePoint
OnBeforeGetDocumentIdentifierVaultPDF Dispatcher77119YesOverride the document ID used in the PDF filename and documentId payload field
OnBeforeGetDispatcherAccessTokenVaultPDF Dispatcher77119YesBypass OAuth; inject a pre-fetched or test dispatcher token
OnBeforeBuildJsonVaultPDF SharePoint Provider77117YesReplace JSON payload before SharePoint upload
OnAfterBuildJsonVaultPDF SharePoint Provider77117NoTransform JSON after build, before the SharePoint PUT
OnBeforeGetFolderNameVaultPDF SharePoint Provider77117YesOverride the SharePoint folder for payload JSON upload
OnBeforeUploadVaultPDF SharePoint Provider77117YesCancel or mock the SharePoint PUT (used in test extensions)
OnAfterUploadVaultPDF SharePoint Provider77117NoPost-upload actions; receives the computed SharePoint URL
OnUploadErrorVaultPDF SharePoint Provider77117NoHandle upload failure; receives the raw error response body
OnBeforeGetAccessTokenVaultPDF SharePoint Provider77117YesBypass built-in OAuth for Graph calls; inject Managed Identity or Key Vault token
OnAfterGetAccessTokenVaultPDF SharePoint Provider77117NoObserve or transform the Graph access token after acquisition
OnBeforeGetSettingVaultPDF Settings Mgt77110YesIntercept setting reads; provide values from Key Vault or custom config tables
OnAfterGetSettingVaultPDF Settings Mgt77110NoLog or transform a setting value after it is read
OnBeforeSetContextVaultPDF Gallery Context77111YesReplace the gallery source record before the Template Gallery opens
OnAfterSetContextVaultPDF Gallery Context77111NoObserve context after the gallery is initialised
OnBeforeQueueForTableVaultPDF Posting Subscriber-YesIntercept posting-triggered generation requests; skip or redirect to a different template code
OnAfterSendCompletionNotificationVaultPDF Batch Job Runner77132NoFire after an async batch job finishes and the webhook has been sent; use for AL-based post-completion logic
OnBeforeWorkflowEnforcementVaultPDF Workflow Enforcer77129YesConditionally exempt a record or operation from workflow enforcement checks. Fires from CheckBeforeOperation - the public API partners call to extend enforcement to additional document types

On this page