Skip to content

Conversation

Copy link

Copilot AI commented May 19, 2025

This PR adds integration events to codeunit 50100 SDFileMgt to support integrations from dependent extensions.

For each procedure in the codeunit, I've added appropriate OnBefore and OnAfter integration events with the [IntegrationEvent(false, false)] attribute. These integration points allow dependent extensions to hook into the file management operations without modifying the base code.

The integration events follow a consistent pattern:

  • OnBefore[ProcedureName] - Triggered at the beginning of each procedure
  • OnAfter[ProcedureName] - Triggered after the procedure's main operations are completed

Each event includes relevant parameters that subscribers might need:

  • For upload/download operations: the SDFiles record and filename/filepath
  • For item-related operations: the Item record
  • For JSON operations: both the SDFiles record and the resulting JSON object

Added integration events for the following procedures:

  • Upload
  • Download
  • CreateAndDownloadDataFile
  • ImportBlobToPersistentBlob
  • FindAndExportPersistentBlob
  • SaveReportAsPDF
  • ExportContactsAsCSV
  • ImportItemPictures
  • ExportItemPicture2
  • CreateJSON

Example usage from a dependent extension:

[EventSubscriber(ObjectType::Codeunit, Codeunit::SDFileMgt, 'OnBeforeUpload', '', false, false)]
local procedure MyBeforeUploadHandler()
begin
    // Custom logic before upload
end;

[EventSubscriber(ObjectType::Codeunit, Codeunit::SDFileMgt, 'OnAfterUpload', '', false, false)]
local procedure MyAfterUploadHandler(var SDFiles: Record "SD Files"; FilePath: Text)
begin
    // Custom logic after upload
end;

Fixes #1.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits May 19, 2025 20:27
Co-authored-by: demiliani <33155438+demiliani@users.noreply.github.com>
Co-authored-by: demiliani <33155438+demiliani@users.noreply.github.com>
Co-authored-by: demiliani <33155438+demiliani@users.noreply.github.com>
Copilot AI changed the title [WIP] Add integration events to codeunit 50100 Add integration events to codeunit 50100 SDFileMgt May 19, 2025
Copilot AI requested a review from demiliani May 19, 2025 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add integration events to codeunit 50100

2 participants