Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / Can we import any CSV ...
Finance forum

Can we import any CSV file using DMF which does not have any unique column in Dynamics 365 Finance and operation

(0) ShareShare
ReportReport
Posted on by

I want to import a csv file from legacy system which does not have any unique column or even combination of columns is also not unique. I am getting following error "File contains duplicate rows, cannot insert data into staging due to unique key violation." But when I put any unique column , I can do import successfully . So it is limitation in DMF that we cannot import such type of files which does not have unique keys?

I also tried using "FileUploadTemporaryStorageResult"  to import the file which worked well in case of manually .  But when tried to implement same in Batch using "SysOperation" framework , generated parameter four type of inputs.

Let me know if someone implemented CSV  file import using SysOperation framework or even in Batch in Dynamics 365 Finance and operation ?

  • Ludwig Reinhard Profile Picture
    Microsoft Employee on at
    RE: Can we import any CSV file using DMF which does not have any unique column in Dynamics 365 Finance and operation

    Hello Rupesh,

    If your question has been answered, please be so kind and mark the answer.

    Many thanks and best regards,

    Ludwig

  • Suggested answer
    Rupesh Srivastava Profile Picture
    on at
    RE: Can we import any CSV file using DMF which does not have any unique column in Dynamics 365 Finance and operation

    Thanks Martin.

  • Martin Dráb Profile Picture
    232,000 Most Valuable Professional on at
    RE: Can we import any CSV file using DMF which does not have any unique column in Dynamics 365 Finance and operation

    But it's useless and wasteful, you won't get anything from having the same values duplicated.

    For example, let's say you have a table with two fields: ID and Name. Then you import the same values several times:

    ID Name
    001 Name 1
    001 Name 1
    001 Name 1

    Then you have code working with these values, such as:

    select firstOnly Name from t1
        where t1.Id == "001";

    Notice that you don't know which of the three records will be selected and it doesn't matter. And notice that it will behave exactly the same if you keep just one record there - you can import just one without losing any information. That's why having several records with exactly the same values isn't useful.

    That you don't need to keep duplicate values doesn't mean that they should make changes to their legacy system. The import logic is up to you and you can ignore or update records that you've already inserted.

  • Rupesh Srivastava Profile Picture
    on at
    RE: Can we import any CSV file using DMF which does not have any unique column in Dynamics 365 Finance and operation

    yes I agree with Martin but my client does not want to make any changes in legacy system as it is third party application which is source for our import. This is the reason we want to first import as it is . I imported also writing custom code to read the CSV file but struggling with keeping in batch using sysoperation framework.

  • Suggested answer
    nmaenpaa Profile Picture
    101,156 Moderator on at
    RE: Can we import any CSV file using DMF which does not have any unique column in Dynamics 365 Finance and operation

    You could automate the adding of the running number (or GUID) with PowerShell or any other tool. Or produce it in the source system.

    But I think Martin asked the important question - why would you need to have duplicate / identical records in D365FO? What value do they have? What data is this, and how is it used?

  • Rupesh Srivastava Profile Picture
    on at
    RE: Can we import any CSV file using DMF which does not have any unique column in Dynamics 365 Finance and operation

    Thanks Nikolaos for reply.

    You are suggesting to insert an unique field in CSV file and then  import it ?  Or something a default incremental value will be added by code ?

    As it will be daily routine task so manually modifying CSV file daily is not possible solution.

  • Martin Dráb Profile Picture
    232,000 Most Valuable Professional on at
    RE: Can we import any CSV file using DMF which does not have any unique column in Dynamics 365 Finance and operation

    What's the point of having lines in a table with all values exactly the same? It seems pretty useless...

  • Suggested answer
    nmaenpaa Profile Picture
    101,156 Moderator on at
    RE: Can we import any CSV file using DMF which does not have any unique column in Dynamics 365 Finance and operation

    DMF can't import non-unique rows because it has no way of knowing whether it should create new records or update existing ones in D365.

    You could add a new integer or int64 column to your entity, and enter a running number to it before importing. Then all rows are handled as unique.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,278 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,000 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans