27 Mar’19

D365 Business Central

How to Attach Documents to any Record of any Table in Business Central

Introduction:

Attachment is a relatively new functionality in Business Central. Unlike Links you need not store the links to the document but attach the document itself. In this blog I’ll be showing how to customize Business Central to attach documents to any table.

Pre-requisite:

VS Code
Microsoft Dynamics Business Central

Demonstration:

Attachments are stored in Table 1173 Document Attachment Table. Using the standard document attachment table functionality does not support attaching on all the tables / pages. Currently in Business Central attachment functionality is allowed only on Master and Documents.

  • Adding a field in Document Attachment Table to classify if you want to attach documents for different purpose. In this case I wanted to Attach two types of Documents. So I created an Option Type with Scale Ticket and Lab Report which will be set during the insertion of attachment in the Page. Refer: SaveAttachment2 function.

 

 

 

 

 

 

  • Creating a Custom page with Source table as Table 1173 Attachment Document. I’ve created a Custom Page because the standard pages calls a function that does not allow me to attach different types of attachment. Thus the Custom page contains SaveAttachment2 function which allows to mention the type of Attachment for the record.

  • Adding Custom methods to Attach the documents with different types on Single Record.
    i.) Export : This function downloads the attachment that is stored in the system wen clicked on the name

 

 

 

 

 

 

ii.) SaveAttachment2:This function saves the attachment for the record with the specific type of attachment. It stores the TableID, Record Primary Key and then LoadType to specify type of attachment for that load.

GetLoadType: This function is used to pass the type

 

 

 

 

Calling the CustomAttachedPage from the Page/ Table you want to attach.

 

 

 

 

 

 

 

 

 

Output:

From the Record you want to attach the document

 

To download the Attachment, click on the Attachment FileName.

Conclusion:

In this way we can attach documents to any record of any table in Business Central.

Written by

Olister Rumao

Software Engineer

Leave a Reply

Your email address will not be published. Required fields are marked *

Want to streamline your business processes?

  • This field is for validation purposes and should be left unchanged.

Recent Articles

  • How to enable Document ID in SharePoint Online

    16 May’ 2019

    Introduction: As you know that SharePoint Online can be used as a document management platform and with the help of Docu...

    Read more
  • Count Number of files in SharePoint folder

    15 May’ 2019

    Introduction: This blog explains how to Count No of files in SharePoint folder using MS Flow. Steps to be followed:Sel...

    Read more
  • Professional Services Automation (PSA) for CPA firms

    14 May’ 2019

    With the evolution of Technology, every industry is getting process oriented and so are CPA firms getting more organized...

    Read more
  • What if the Resource Requirement Still appears post the task is deleted from Schedule (WBS) in PSA V3?

    13 May’ 2019

    Problem Definition: I have observed a fact in PSA that when the task in PSA Schedule (WBS) is deleted, the corresponding...

    Read more
  • Discount Settings for D365 Sales Line Items – Line Items or Per Unit?

    10 May’ 2019

    For Line Item entities Opportunity Products, Quotes Products, Order Products or Invoice Products, you can chose what typ...

    Read more
  • We respect your privacy.
  • This field is for validation purposes and should be left unchanged.