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

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

D365 On Premise CRM | Upload pdf to a custom entity record under notes and attchments

(4) ShareShare
ReportReport
Posted on by 3,402
Hello, 
 
we are trying to upload pdf files to multiple records inside a custom entity. Can we import them just like we imported the records using excel using 'import data' option
 
Thanks
I have the same question (0)
  • Verified answer
    Daivat Vartak (v-9davar) Profile Picture
    7,829 Super User 2025 Season 2 on at
    D365 On Premise CRM | Upload pdf to a custom entity record under notes and attchments
    Hello NaveenKumar S,
     

    No, you cannot directly import PDF files as attachments to records in a custom entity using the "Import Data" option with an Excel file in Dynamics 365. The "Import Data" feature is designed for importing structured data into fields, not for handling file attachments.

    Why "Import Data" Doesn't Work for Attachments:


    • Data Structure: The "Import Data" tool expects data to be in a tabular format (rows and columns) that maps to the fields of your entity. File attachments, being binary data, don't fit this structure.

    • Storage Mechanism: Attachments in Dynamics 365 are stored in the Annotation (Notes) entity, which is linked to your custom entity records. The "Import Data" feature doesn't have the logic to create these linked Annotation records and associate the file data.

    •  

    Alternative Approaches to Import PDF Attachments:

    1. Power Automate (Recommended for Automation):

       

      • Steps:

        1. Store PDFs in SharePoint or Azure Blob Storage: Upload your PDF files to a SharePoint document library or an Azure Blob Storage container.

        2. Create an Excel File: Prepare an Excel file with the following columns:

          • A column to identify the record in your custom entity (e.g., record ID or a unique identifier).
          • A column containing the URL or file path of the corresponding PDF file in SharePoint or Blob Storage. 

        3. Create a Power Automate Flow:

          • Trigger: Use a "When a row is added, modified, or deleted" trigger on your Excel file in OneDrive for Business or SharePoint.
          • Action: "List rows present in a table" to read the Excel data.
          • Action: "Get a row by ID" (or a similar action) to retrieve the corresponding record from your custom entity based on the identifier from the Excel file.
          • Action: "Create a new record" in the Annotation (Notes) entity.
          • Set the ObjectId field to the ID of the custom entity record.
          • Set the ObjectTypeCode to the entity type code of your custom entity.
          • Use the "Get file content" action (SharePoint) or "Get blob content" action (Blob Storage) to retrieve the PDF file content.
          • Encode the file content to base64.
          • Set the DocumentBody field in the Annotation entity to the base64-encoded file content.
          • Set the FileName field to the name of the PDF file.

        4. Run the Flow: Upload your Excel file to the specified location, and the flow will automatically create the attachments. 

      • Advantages:

        • Automated and efficient for large volumes of files.
        • Can handle various file storage locations.

    2. Custom Code (Plugin or Console Application):

      • Steps:

        1. Develop a custom plugin or console application using the Dynamics 365 SDK.
        2. Read the PDF files from a local directory or network share.
        3. Use the Dynamics 365 SDK to create Annotation (Notes) records and associate them with the corresponding custom entity records.

      • Advantages:

        • Provides more control and flexibility. 

      • Disadvantages:

        • Requires development expertise.
        • More complex to implement. 

    3. Third-Party Tools:

      • Explore third-party data migration or integration tools that might offer features for importing file attachments.  

    4.  

    Key Considerations:

    • File Size Limits: Be aware of any file size limits imposed by Dynamics 365 or your storage provider.
    • Performance: Importing large volumes of attachments can impact performance. Consider batching or optimizing your import process.
    • Error Handling: Implement robust error handling in your Power Automate flow or custom code.

    Recommendation:

    For most scenarios, Power Automate is the recommended approach due to its automation capabilities and ease of use. It allows you to efficiently import PDF attachments from various storage locations without requiring extensive development.

     
    If my answer was helpful, please click Like, and if it solved your problem, please mark it as verified to help other community members find more. If you have further questions, please feel free to contact me.
     
    My response was crafted with AI assistance and tailored to provide detailed and actionable guidance for your Microsoft Dynamics 365 query.
     
    Regards,
    Daivat Vartak
  • Verified answer
    Holly Huffman Profile Picture
    6,520 Super User 2025 Season 2 on at
    D365 On Premise CRM | Upload pdf to a custom entity record under notes and attchments
    Hi there! Good morning, evening, or afternoon - depending on where you are :) Hope you are well today!
     
    Unfortunately, the "Import Data" option in Dynamics 365 On-Premise CRM does not natively support importing files, such as PDFs, into the Notes and Attachments section of records. However, there are alternative approaches to achieve this:
    1. Using a Custom Script or Tool
    • Develop a custom script or application using the Dynamics 365 SDK to automate the upload of PDF files to the Notes and Attachments section of the custom entity records.
    • The script would:
      • Match each PDF file to the corresponding record based on a unique identifier (e.g., record ID or name).
      • Use the Annotation entity in Dynamics 365 to create a note and attach the PDF file.
    2. Third-Party Tools
    • Explore third-party tools or add-ons that support bulk file uploads to Dynamics 365. These tools often provide user-friendly interfaces for mapping files to records and automating the upload process.
    3. Manual Upload
    • If the number of records is manageable, you can manually upload the PDF files to each record:
      • Open the custom entity record.
      • Navigate to the Notes section.
      • Attach the PDF file.
    4. Data Import with File References
    • If you have a large number of records and files, you could:
      • Use the "Import Data" option to import the records with a reference to the file path of each PDF.
      • Develop a custom workflow or plugin to process the file paths and upload the corresponding PDFs to the Notes section.
    5. Power Automate (Optional)
    • If you have access to Power Automate (formerly Microsoft Flow), you can create a flow to automate the process of uploading files to Dynamics 365. This would require configuring the flow to:
      • Read the file paths from a data source (e.g., SharePoint or a local folder).
      • Match the files to the appropriate records.
      • Upload the files to the Notes section.
    Each of these methods has its own advantages and limitations, depending on your technical expertise, resources, and the volume of data.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daniyal Khaleel Profile Picture

Daniyal Khaleel 150

#2
DAnny3211 Profile Picture

DAnny3211 81

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 66 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans