Attaching documents in a custom page FactBox in Dynamics 365 Business Central involves creating a custom FactBox that allows users to manage document attachments. This can be done by creating a new page extension to add the FactBox, and using the Attachment table to handle the documents.
Firstly, within the development environment, you would create a custom page factbox extension object that includes the necessary fields for attaching documents. This involves defining the fields for storing document metadata such as file name, file type, and file content.
Step-by-Step Guide:
Create a one-part page using a standard Document Attachment Factbox page.
Using subpage link Property to Link part page with our custom page table id, No, and document type field.
After the Need to event subscriber First use OnBeforeDrillDown event.
Database table uses our custom table.
Second Event Subscriber OnAfterInitFieldsFromRecRef.
Third Event Subscriber OnAfterOpenForRecRef.
Added a setrange for filter so the same document attaches only for current rec, not for all records.
After Clicking on the Document Attachment factbox page.
Clicking On Attach file and select a file.
Output:
Pls have a look at the below image for the front end output:
Thank you for investing your time to read our blog! We’re passionate about sharing valuable insights to help you navigate the world of Business Central.
If you’re curious about how we can assist you in reaching your goals, don’t hesitate to get in touch. Our dedicated team is ready to provide support every step of the way.
Let’s turn your vision into reality together!