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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Importing data, need to write a custom console application.

(0) ShareShare
ReportReport
Posted on by 215

Good morning guys,

For this week i have a task that takes a csv file given from our client and i need to import that file in my leads.

Now i already tested the simple way of using import data, uploading the file choosing the mapping setting, unfortunately this is where my problems start.

Biggest issue i have is that when i upload the file MS CRM seems not to be uploading all of my headers, which means im losing a lot of data somewhere during the upload of the file.

Just to put things in context i have 24 columns in my source file but i'm only able to map 12 of those when i come to the mapping step.(when I say map i mean literally i cannot find the rest of the columns from my source file even though i have matching fields as part of my entity)

Any advice on how to write a console application that consumes the source file and does the mapping programmatically and then uploads the newly created csv file is greatly appreciated.

Cheers, Filip.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at

    Hi,

    Not sure why you are not able to see all of you columns, Did you try to download Import template from CRM and fill your data there and tried to import.

    Also if you are looking for sample code to import file, this SDK example should help you: https://msdn.microsoft.com/en-in/library/hh547396.aspx

    Thanks

  • Filip Vanchevski Profile Picture
    215 on at

    Yeah the first thing i did after i tried to upload the original file from our client is to download a template a compare them.

    There are some differences, so thats why i decided that i will need to do this by writing a plugin or coding in general so i can map the data from the original source file to my entity, the problem is that the client sent us a file that has different heading titles for the columns then some of the fields in the entity, but the strange thing is that even some of the ones that do match are not showing when i need to map for example Name (from source file) with First Name(field of entity).

    While waiting for suggestions on how to proceed I also read the sample code, the problem is i'm pretty new with CRM (started to work on the 1st of October), and my company doesn't use early bound classes, and it's still kinda confusing for me, if there are any samples without using early bound that'd be great.

    I will dive deeper to try to understand how it works with early bound and i hope i can get the same functionality without them.

    In the mean time any samples or blogs that explain how to do this without early bound classes would be great.

  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at

    Hi,

    I don't see this sample in late bound, but instead of using early bound you can use late bound your code the logic should be similary and you need to refer generic Entity class , for example you can refer this example which is using late boud method to create CRM entity records: msdn.microsoft.com/.../gg328416.aspx;MSPPError=-2147217396

    If you are facing any issue you can share it here.

    Thanks

  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    Hi Filip,

    I think that writing a console application to import some data into Leads from a csv file is an overkill.

    If for some reason you are unable to import the csv file as it is, why not use SSIS. This would be much easier, and you can use Kingswaysoft SSIS Connector for example to map your fields from the source to the destination CRM Components.

    Try it out, I don't think your will regret it.

    Hope this helps.

  • Filip Vanchevski Profile Picture
    215 on at

    I will look into it today hopefully it will be easier.

    I would like to update you on the situation so you can get a better understanding of my problem though.

    I agree that it might be overkill if the csv file contained only information for the lead entity however, the lead entity has sub-grids from other entities and right now im thinking that with a console app i can create both the lead and the other entities and establish the connection between them so that they can be created together.

    For example i have a sub-grid from the entity Products on the lead entity, this means that i need to also create new Product records, and associate them with the corresponding lead, as i'm typing this i realize this might take quite a bit time, again if you have any advice for me after this new info please share it with me as i'm in the deep now and i'm having a hard time maintaining a clear focus on how to proceed.....

    Cheers Filip.

  • Filip Vanchevski Profile Picture
    215 on at

    P.S Mahen the link you sent gives me a 404 error can you resend it.

    Thanks.

  • Mahendar Pal Profile Picture
    45,095 on at

    Hi Filip,

    Obviously using SSIS will be much easier that writing your own console app, But on the other hand if you want to learn CRM development writing console can definitely help you.

    Also as I saild earlier going through SDK will surly will help you, you can create primary entity and related record using SDK.

    Hope it will help you.

    thanks

  • Mahendar Pal Profile Picture
    45,095 on at

    Here it is: msdn.microsoft.com/.../gg328416.aspx

    And if you have already downloaded SDK, you can find this sample at SampleCode\CS\GeneralProgramming\LateBound\CRUDOperationsDE.cs

    Thanks

  • Filip Vanchevski Profile Picture
    215 on at

    Yeah I already have the SDK downloaded, i'm going through it now, trying to figure out whats the best approach.

    I will continue with the console app, i'll have to take your word that is is harder, but i gotta learn it at some point, and i figure better now then, later....

    Good thing is i'm not pressed by a deadline on this yet, so i have time to do my research and get it done.

    At this point im looking at the ImportWithCreate Sample from SDK it seems to be the closest to what i have to do, i hope to have some initial results by the end of the week.

    I will keep the thread open until then in case i run into some other problems, and will verify your answers after that.

    Thanks for taking the time to help me out on this, really appreciate it!

    Cheers,

    Filip.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans