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 :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Data import programmatically

(0) ShareShare
ReportReport
Posted on by 2,665

Hi,

We are moving from crm 2016 onprem to Dynamics 365 online soon. We do have a custom data import feature coded long ago with organizationservice, Create/update requests etc.

I am a little lost with plethora of features in Dynamics 365 online. Is there any new feature that I could use to implement the same thing we had for years in onprem?

Our onprem setup - Basically, we have our users upload csv files everyday(html webresource) and file gets stored on a server location. We scheduled our code as windows task scheduler which processes the file and does inserts/updates to our CRM application. 

Can somebody please guide me through some options in Dynamics Online that I can implement?

Thanks.

I have the same question (0)
  • David Jennaway Profile Picture
    14,065 on at
    RE: Data import programmatically

    If it's easiest to keep your current code, you could probably refactor it to run as a plugin, and have the user upload the csv files as notes. The general approach would be

    • User uploads the file as a note. It might be easiest to designated a specific entity that these notes should be linked to, to separate them from other notes
    • The plugin code runs on create / update of the note and checks if there's a file
    • You'd need code to read the file contents. These are stored as a base64 encoded string in the documentbody field. You would need to convert this to a byte[] array, then probably use a memory stream to read it as a file
    • The rest of the create/update code can probably be very similar to what you already have, though you can use the IOrganizationService instance that you derive from the plugin context, rather than separately instantiating it as you would in a console app
    • I'd probably use some naming convention on the subject or description of the note to indicate that it has finished processing. Unfortunately you can't add custom fields to the note entity
  • crmprogrammer2013 Profile Picture
    2,665 on at
    RE: Data import programmatically

    Thanks, Wahaj. I did look into Power Automate but my requirement has multiple entities associated to each other. Like I have to process the csv file and create parent entity, then child entity and this child entity inturn has to be associated to another entity. So, it involves multiple entity associations which becomes little out of hands with Power automate I think compared to the flexibility we usually have with code. That's why I am leaning more towards the same approach that we had in onprem setup. But like you said, SharePoint approach sounds good. Any other approaches you could suggest other than Power Automate? Thanks again.  

  • Suggested answer
    Wahaj Rashid Profile Picture
    11,321 on at
    RE: Data import programmatically

    Hi,

    For Online version, you have to use a one of the document storage features for uploading the files (as you won't have access to file server).

    1. SharePoint Integration: let users upload files to Sharepoint Document Libraries. Once the file is uploaded, you can trigger a Microsoft PowerApps flow to parse the file and load data into D365 using Common Data Service.
    2. Custom Entity with Notes: you can create a custom entity and let users attach files to the notes section. Again, you can trigger PowerApps flow to parse the file contents and load data in D365.

    You can still use your custom web resource for file upload, but i would suggest uploading the file to SharePoint or as Notes Attachment and let flow do the integration work.

    Here are few links to get you started:

    https://docs.microsoft.com/en-us/power-platform/admin/data-integrator

    Parsing CSV file in Flow:

    https://medium.com/plumsail/how-to-parse-a-csv-file-using-microsoft-flow-azure-logic-apps-or-powerapps-e8f6f44d7f6b#:~:text=Conclusion,the%20help%20of%20Plumsail%20Documents.

    You can also use Azure Blob Storage (which is cheaper):

    https://d365blogger.com/2017/07/17/dynamics-365-attachment-management-with-azure-blob-storage/

    Let me know if you have further questions.

    Best,

    Wahaj

    (if it helps, mark it verified)

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Sahan Hasitha Profile Picture

Sahan Hasitha 394

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 124 Super User 2025 Season 2

#3
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 123

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans