Skip to content

Add integration events to codeunit 50100 SDFileMgt - #2

Draft
demiliani with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-1
Draft

Add integration events to codeunit 50100 SDFileMgt#2
demiliani with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-1

Conversation

CopilotAI commented May 19, 2025

Copy link
Copy Markdown

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)]
localprocedure MyBeforeUploadHandler()begin// Custom logic before uploadend;
[EventSubscriber(ObjectType::Codeunit, Codeunit::SDFileMgt, 'OnAfterUpload', '', false, false)]
localprocedure MyAfterUploadHandler(var SDFiles: Record "SD Files"; FilePath: Text)begin// Custom logic after uploadend;

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.

CopilotAIand 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>
CopilotAI changed the title [WIP] Add integration events to codeunit 50100Add integration events to codeunit 50100 SDFileMgtMay 19, 2025
CopilotAI requested a review from demilianiMay 19, 2025 20:33
Sign up for freeto 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

@demiliani