REFRACT Platform for Dynamics 365 Business Central

Event & Payload Reference - REFRACT PDF Business Central

Complete integration event reference for all 28 REFRACT AL integration 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 REFRACTPDF_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.expiresInMinutesintegerEach signer's window, in minutes. 0 leaves it out of the payload, so the Dispatcher default of 7 days applies. Otherwise it must be from 60 to 10080; a value outside that range refuses the render.
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 REFRACT 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 28 integration events published by the extension, grouped by publisher object. All use [IntegrationEvent(false, false)] unless noted. 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.

EventPublisherIDIsHandledPurpose
OnBeforeGetDefaultLinesTableIdtable "VPF Template Header" (global procedure, not local)73524578YesOverride lines table auto-detection for custom header/lines document structures. Subscribe with ObjectType::Table, not ObjectType::Codeunit.
OnBeforeFindParentFieldIdcodeunit "VPF JSON Builder"73524587YesRegister a custom alias for a child key field name on a parent table when the default convention-based lookup does not apply
OnBeforeBuildJsoncodeunit "VPF JSON Builder"73524587YesReplace the JSON payload entirely before field mapping runs
OnAfterBuildJsoncodeunit "VPF JSON Builder"73524587NoTransform JSON after field mapping; inject additional fields
OnFormatFieldcodeunit "VPF JSON Builder"73524587YesOverride how a specific field value is serialised (e.g. custom date format, enum label)
OnBeforeAddFieldcodeunit "VPF JSON Builder"73524587YesSkip or rename a field before it is written to the JSON object
OnAfterAddFieldcodeunit "VPF JSON Builder"73524587NoObserve a field after it has been written to the JSON object
OnBeforeGetRootNodeNamecodeunit "VPF JSON Builder"73524587YesOverride the root JSON node name for a table
OnResolveQuerySectioncodeunit "VPF JSON Builder"73524587YesInject a Query-backed JSON section into the payload
OnBeforeGetDefaultFolderNamecodeunit "VPF Dispatcher"73524594YesOverride the PDF storage folder name in SharePoint
OnBeforeGetDocumentIdentifiercodeunit "VPF Dispatcher"73524594YesOverride the document ID used in the PDF filename and documentId payload field
OnBeforeGetDispatcherAccessTokencodeunit "VPF Dispatcher"73524594YesBypass OAuth; inject a pre-fetched or test dispatcher token
OnBuildBatchLineEntriescodeunit "VPF Batch Dispatcher"73524596YesInject additional expanded line entries into a batch generation run
OnBeforeBuildJsoncodeunit "VPF SharePoint Provider"73524592YesReplace JSON payload before SharePoint upload. A distinct event from the JSON Builder's OnBeforeBuildJson above - pick the right publisher object.
OnAfterBuildJsoncodeunit "VPF SharePoint Provider"73524592NoTransform JSON after build, before the SharePoint PUT
OnBeforeGetFolderNamecodeunit "VPF SharePoint Provider"73524592YesOverride the SharePoint folder for payload JSON upload
OnBeforeUploadcodeunit "VPF SharePoint Provider"73524592YesCancel or mock the SharePoint PUT (used in test extensions)
OnAfterUploadcodeunit "VPF SharePoint Provider"73524592NoPost-upload actions; receives the computed SharePoint URL
OnUploadErrorcodeunit "VPF SharePoint Provider"73524592NoHandle upload failure; receives the raw error response body
OnBeforeGetAccessTokencodeunit "VPF SharePoint Provider"73524592YesBypass built-in OAuth for Graph calls; inject Managed Identity or Key Vault token. A distinct event from the Dispatcher's OnBeforeGetDispatcherAccessToken above - pick the right publisher object.
OnAfterGetAccessTokencodeunit "VPF SharePoint Provider"73524592NoObserve or transform the Graph access token after acquisition
OnBeforeGetSettingcodeunit "VPF Settings Mgt"73524585YesIntercept setting reads; provide values from Key Vault or custom config tables
OnAfterGetSettingcodeunit "VPF Settings Mgt"73524585NoLog or transform a setting value after it is read
OnBeforeSetContextcodeunit "VPF Gallery Context"73524586YesReplace the gallery source record before the Template Gallery opens
OnAfterSetContextcodeunit "VPF Gallery Context"73524586NoObserve context after the gallery is initialised
OnBeforeQueueForTablecodeunit "VPF Posting Subscriber"73524612YesSkip the default posting-triggered queuing for a table entirely. The signature has no template-code parameter - no specific template is chosen yet at this point, so a subscriber can suppress the default behaviour but not redirect it to a substitute template.
OnAfterSendCompletionNotificationcodeunit "VPF Batch Job Runner"73524607NoFire after an async batch job finishes and the webhook notification step has run; use for AL-based post-completion logic
OnBeforeWorkflowEnforcementcodeunit "VPF Workflow Enforcer" (global procedure, not local)73524604YesConditionally 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