web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Document attachements V 28.0

(4) ShareShare
ReportReport
Posted on by 74

Dear Team,

We had previously customized attachment functionality across different pages such as Warehouse Receipts and Payment Request pages.

Recently, due to compatibility changes, we modified the FactBox from "Document Attachment Factbox" to "Doc. Attachment List Factbox". After this change, we started facing the following issue while uploading attachments.

Error Message:

 

The record is not open.

"Document Attachment"(Table 1173).InsertAttachment line 4
"Document Attachment"(Table 1173).SaveAttachmentFromStream line 7
"Document Attachment"(Table 1173).SaveAttachment line 9
"Document Attachment"(Table 1173).SaveAttachment line 3
"Doc. Attachment List Factbox"(Page 1178)."AttachmentsUpload - OnAction"(Trigger) line 18

 

 

Aditional Details:
This issue occurs during attachment upload.
We are using customized logic along with standard FactBox changes.
The problem started after switching to the new FactBox.

Request:

Has anyone encountered this issue after migrating to "Doc. Attachment List Factbox"?
Any guidance on resolving the “record is not open” error or handling RecRef correctly in this scenario would be helpful.

Thanks in advance!

Doc.png
I have the same question (0)
  • Suggested answer
    Yash_Mistry Profile Picture
    512 on at
    Hello,

    Make sure you have subscribed to the events listed below.
    Below is my custom table: Requisition Header. Might be because you have not Subscribed to this event.

     
    -here you can map your Primary Key field ID. There are Similar Events for Line No. primary key too.
     
    Hope this helps resolve your issue.
    If this solution was helpful, please consider marking it as Verified Answer.
     
    Thanks,
    Yash Mistry
     
  • Suggested answer
    OussamaSabbouh Profile Picture
    17,623 Super User 2026 Season 1 on at
    Hello,
    this usually happens when the new Doc. Attachment List FactBox is added to a custom page but the FactBox is not being given a valid/open parent record reference; Page 1178 uploads through standard table Document Attachment logic, and that logic expects the source record RecRef to be initialized from the current page record before calling SaveAttachment/InsertAttachment. So the fix is normally not in table 1173, but in your page integration: compare your custom page part setup with a standard BC page that already uses Doc. Attachment List FactBox, make sure the part is linked with the correct SubPageLink / record key fields, and if you have custom attachment code, ensure you call the standard “open from source record” pattern before upload instead of passing an empty/unopened RecordRef. Also note Microsoft says the new Doc. Attachments List FactBox replaces the legacy attachment FactBox and has the same actions, so after switching FactBoxes, old custom logic made for Document Attachment FactBox may need to be adjusted. 
    Regards,
    Oussama Sabbouh
  • Suggested answer
    Grigorios Mavrogeorgis Profile Picture
    2,514 Super User 2026 Season 1 on at

    Hi,

    The "record is not open" thing usually means the RecordRef going into table 1173 is not opened on the source record before InsertAttachment runs. Classic one after FactBox migrations.

    In the old Document Attachment FactBox, the RecRef.Open and GetTable were happening inside the FactBox itself, so custom code never had to worry about it. The new Doc. Attachment List FactBox does it differently, the source record is passed in a different way, and if your code on Warehouse Receipts or Payment Request was relying on the old plumbing, the RecRef ends up empty or closed by the time SaveAttachmentFromStream is called. That is exactly why the error pops on line 4 of InsertAttachment.

    Easiest fix, open the RecordRef yourself before calling SaveAttachmentFromStream. Something like

    RecRef.Open(Database::"Warehouse Receipt Header");

    RecRef.GetTable(WhseReceiptHeader);

    DocumentAttachment.SaveAttachmentFromStream(InStream, RecRef, FileName);

    One more thing that bit us last time on a similar case, the AttachmentsUpload OnAction on page 1178 has changed signature, and if your custom extension was subscribing to it or extending it, the parameters do not line up anymore. Worth opening page 1178 source and comparing with what your code expects.

    If you want to be sure where it dies, just throw a Message before InsertAttachment with RecRef.Number and RecRef.IsTemporary. If Number is zero or RecRef is closed, you have your answer in two seconds.

     Tick the checkbox below to mark the answer as verified, if it helped resolve your question.
     
    Regards
    Gregory Mavrogeorgis
     

     
     
  • Suggested answer
    YUN ZHU Profile Picture
    101,995 Super User 2026 Season 1 on at
    Hi, The following discussion includes several examples that hopefully will provide some hints.
     
     
    Thanks.
    ZHU

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,050 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,441 Super User 2026 Season 1

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 1,175 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans