Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Data import using SDK results in failed import but no error messages

Posted on by

I am trying to do a data import as an automated process using the SDK, but the import overall shows up with a failed status even though the parse, transform, and import jobs all succeed without errors.  I'm using CRM Online 2011 UR12.  I've looked over the data import sample project in the SDK and read the MSDN documents related to data import, but these all seem to be lacking in details.  I have a data map that was built using an advanced find in CRM, that was exported and opened in excel where I put data into the file.  I then set up an app to import the file using the SDK, the import and the individual steps of the import all show up, including the record count, but the record counts on the job are as follows: Successes: 0, Partial Failures: 0, Failures: 0, Total Processed: 720.  The XML source file should be fine, I can take a file with the exact same format, just different records, and it will import fine using the CRM import wizard.  I attached a file to this post containing the code I used to do the import.  Also, here are some screenshots of what the import looks like in CRM:

3386.crm_5F00_import2.PNG

These are the Import File Parse, Transform Parse Data, and Import jobs:

Does anyone know what might be causing this to fail?  Any ideas or suggestions would be helpful.  Thanks!

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Data import using SDK results in failed import but no error messages

    The ImportFile sourceEntityName property must be the same as the ImportMap sourceEntityName property.  That value can be retrieved with the following code:

                   var query = new QueryExpression(ImportEntityMapping.EntityLogicalName) { ColumnSet = new ColumnSet("sourceentityname") };

                   query.Criteria.AddCondition(new ConditionExpression("importmapid", ConditionOperator.Equal, importMapId));

                   var result = serviceProxy.RetrieveMultiple(query);

                   return result.Entities.Select(c => c.ToEntity<ImportEntityMapping>()).First().SourceEntityName;

  • Gayatri Shevde Profile Picture
    Gayatri Shevde 460 on at
    RE: Data import using SDK results in failed import but no error messages

    Here I would suggest you to create a Ticket with the syouurt

  • Gayatri Shevde Profile Picture
    Gayatri Shevde 460 on at
    RE: Data import using SDK results in failed import but no error messages

    Hello Rumcgs,

    I would suggest you to create the ticket with Support to get your questions answered eveything

  • rumcajs Profile Picture
    rumcajs 10 on at
    RE: Data import using SDK results in failed import but no error messages

    Hi ak350,

    I resolved my problem. I checked mapping file

    and found following rows

    <EntityMaps>

       <EntityMap TargetEntityName="myTargetEntity" SourceEntityName="mySource" Dedupe="Ignore" ProcessCode="Process">

    In my code for import I was creating import file

                   Entity importFile = new Entity("importfile");

                   importFile.Attributes.Add("targetentityname", myTargetEntity);

                   importFile.Attributes.Add("sourceentityname", differentSourceEntity);

    I found out that I had different source entity name in my code and different in mapping file. So maybe it will be helpful also for you to check if your map file and code matches. It is really bad that CRM shows that everything goes well and result is failure with no trace to mistakes.

    Probably your mistake will be different but hopefully my discover could lead you to find it.

    In overall when you are able to import your data manualy using same Mapping Xml problem must be in the code which does import.

  • AK350 Profile Picture
    AK350 on at
    RE: Data import using SDK results in failed import but no error messages

    I don't have an answer yet, I have an open support ticket with Microsoft but I'm waiting for them to get back to me.  In the mean time, I've gone down the path of using the ExecuteMultipleRequest to create a bunch of records in batch.  I ran only a couple of tests with that, so I don't know where the record limit is, but at 500 records it seems to be working very well.  The only drawback to this process is that you can't import records with an inactive status as you could do with the data import.  The workaround would be to do a separate ExecuteMultipleRequest do update all the statuses to inactive after the records are created.

    I'll post again when I get an answer from Microsoft.

  • rumcajs Profile Picture
    rumcajs 10 on at
    RE: Data import using SDK results in failed import but no error messages

    were you able to solve this? I am facing this problem too...thanks

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!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans