Why do you need this change?
We use Azure Blob Storage to store the files in the "Document Attachment" table instead of the database (Media field). To maintain consistency between the recors and the physical path (blob path), we leverega existing events during the copy processes:
- OnCopyAttachmentsForPostedDocsLinesOnAfterSetToTableID
- OnCopyAttachmentsOnAfterSetToDocumentFilters
- OnCopyAttachmentsForPostedDocsOnBeforeToDocumentAttachmentInsert
In those events, we can download the original blob and republish it to ABS, generating a new path that incorporates the new "No." value. However, in the MoveAttachmentsWithinSameRecordType procedure (whhen moving/rename attachments within the same record type by changing the "No."), there is no event before the Insert that allows this. Furthermore, it deletes the original record, causing the blob in ABS to be deleted as well, and the new record continues to reference the same blob path.
Describe the request
Proposed event:
Name: OnMoveAttachmentsWithinSameRecordTypeOnBeforeInsert
Parameters:
var DocumentAttachmentToCreate: Record "Document Attachment"
MoveToRecRef: RecordRef
MoveToRecNo: Code[20]
Suggested insertion (just before the Insert)
// ...existing code...
repeat
Clear(DocumentAttachmentToCreate);
DocumentAttachmentToCreate.Init();
DocumentAttachmentToCreate.TransferFields(DocumentAttachmentFound);
DocumentAttachmentToCreate.Validate("No.", MoveToRecNo);
OnMoveAttachmentsWithinSameRecordTypeOnBeforeInsert(DocumentAttachmentToCreate, MoveToRecRef, MoveToRecNo);
DocumentAttachmentToCreate.Insert(true);
until DocumentAttachmentFound.Next() = 0;
// ...existing code...
IntegrationEvent declaration:
[IntegrationEvent(false, false)]
local procedure OnMoveAttachmentsWithinSameRecordTypeOnBeforeInsert(var DocumentAttachmentToCreate: Record "Document Attachment"; MoveToRecRef: RecordRef; MoveToRecNo: Code[20])
begin
end;
Without it, a function gap remains, forcing subsecquent solutions that are less efficient and more fragile.
Thank you very much for your time.
Internal work item: AB#614927
Why do you need this change?
We use Azure Blob Storage to store the files in the "Document Attachment" table instead of the database (Media field). To maintain consistency between the recors and the physical path (blob path), we leverega existing events during the copy processes:
In those events, we can download the original blob and republish it to ABS, generating a new path that incorporates the new "No." value. However, in the
MoveAttachmentsWithinSameRecordTypeprocedure (whhen moving/rename attachments within the same record type by changing the "No."), there is no event before theInsertthat allows this. Furthermore, it deletes the original record, causing the blob in ABS to be deleted as well, and the new record continues to reference the same blob path.Describe the request
Proposed event:
Name:
OnMoveAttachmentsWithinSameRecordTypeOnBeforeInsertParameters:
var DocumentAttachmentToCreate: Record "Document Attachment"MoveToRecRef: RecordRefMoveToRecNo: Code[20]Suggested insertion (just before the
Insert)IntegrationEvent declaration:
Without it, a function gap remains, forcing subsecquent solutions that are less efficient and more fragile.
Thank you very much for your time.
Internal work item: AB#614927