Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Using Power Automate to initiate importing records

Posted on by 50

I have a need to regularly import files into Dynamics (at least 4-5 times a day). I would use the standard "add a row" connector on Dataverse, however there will be a large number of duplicates in each file, so it is time consuming to deduplicate in Power Automate - as creating via Power Automate appears to bypass all duplicate detection rules that are normally applied when importing.

I'd quite like to automate this, but don't have the capability with C# to write a plugin that does it (and I want to work with sharepoint as a source), so was considering Power Automate.

I have set up a flow that does:

  1. Create Data Import (import) record
  2. Create Import Source File (importfile) record with the source file from a Sharepoint source (as comma separated values)
  3. Initiate a ParseImport action using the importid
  4. Wait for the parse to complete (monitor the System Jobs table)
  5. Initiate a TransformImport action using the importid
  6. Wait for the transform to complete (monitor the System Jobs table)
  7. Initiate an ImportRecordsImport action using the importid

This however fails to complete the import, and I can't find anywhere to look at logs for why it is failing.

Each of the three system jobs succeed (as they would with a normal import), and the importfile record shows the correct number of rows, headers etc (so appears to be parsed correctly).

I suspect my issue stems from missing a key parameter or step in this process - can anyone advise? Or suggest an alternative (free) option? My source data is fairly flexible in storage location/format.

  • AK1443 Profile Picture
    AK1443 10 on at
    RE: Using Power Automate to initiate importing records

    Hi.. 

    Here's my requirement.

    I need to map the imported contacts in contact entity to a new segment in segments entity using power automate.

    Is there any way how to achieve it?   

  • Alan Roberts Profile Picture
    Alan Roberts on at
    RE: Using Power Automate to initiate importing records

    OK so you just need to make sure that whatever value you ended up with in the automatically created map as the sourceEntityName is the value that you enter in to the Source Entity field of the Create ImportFile power automate action.

  • SBeal Profile Picture
    SBeal 50 on at
    RE: Using Power Automate to initiate importing records

    Further to Alan's comments, if these are the tags in the datamap xml - I used a map that I created in a manual import to ensure it was all set up properly before setting up the automated imports, so they were all populated automatically by the manual import process.

  • Alan Roberts Profile Picture
    Alan Roberts on at
    RE: Using Power Automate to initiate importing records

    Hi Abeer,

    The target entity is simply the name of the entity/table that you are importing the data in to.  The source entity name can be anything you want, you just need to make sure that you use the same value in the map (i.e. for sourceEntityName) as in the Create ImportFile power automate action (i.e. in the Source Entity field)

    Cheers

    Alan

  • Abeer Profile Picture
    Abeer 5 on at
    RE: Using Power Automate to initiate importing records

    Alan Roberts Thank you for sharing this but I didn't get how did you do the mapping tags

    <entitymap targetEntity="int_location" sourceentityname="location7" dedupe="ignore" procesCode="Process">

    please if you could help!

  • Alan Roberts Profile Picture
    Alan Roberts on at
    RE: Using Power Automate to initiate importing records

    Glad to hear it is working.  That was the only part I could see where the problem might have been!

  • Suggested answer
    SBeal Profile Picture
    SBeal 50 on at
    RE: Using Power Automate to initiate importing records

    Thanks Alan, the key bit I was missing was setting the SourceEntity of the importfile record to be the same as the chosen importmap.

    It now works seamlessly!

  • Suggested answer
    Alan Roberts Profile Picture
    Alan Roberts on at
    RE: Using Power Automate to initiate importing records

    Very similar to yours really

    1. Setup the import
    3482.step1.png

    2. Set up the file
    5383.step2.png

    I'm just passing the content in from a compose as a test
    Step2b.png

    I am using an existing map with TargetEntityName and SourceEntityName matching the ones above
    step2c.png

    If the SourceEntityName doesn't match the import will fail

    3. Parse the file (Dataverse Connector/Perform a Bound Action/Data Imports table/ParseImport)
    1018.Step3.png

    Then loop checking the system jobs until complete (statecode 3 as per https://docs.microsoft.com/en-us/power-apps/developer/data-platform/webapi/reference/asyncoperation?view=dataverse-latest)
    Stage3b.png

    4. Do a similar thing with the transform  (Dataverse Connector/Unbound Action/TransformImport)
    5367.step4.png
    again looping and checking system jobs for completion

    5. Import the transformed file  (Dataverse Connector/Perform a Bound Action/Data Imports table/ImportRecordsImport)
    step5.png


  • SBeal Profile Picture
    SBeal 50 on at
    RE: Using Power Automate to initiate importing records

    Oh interesting - would be interested in seeing your flow steps/code to see if I can replicate!

  • Alan Roberts Profile Picture
    Alan Roberts on at
    RE: Using Power Automate to initiate importing records

    Thanks anyway.  Somehow I've managed to get it working, but I'm not sure what tweak was the answer.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans