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)

How to insert field value from csv file to Entity using plugin code?

(0) ShareShare
ReportReport
Posted on by 160

I just attach CSV file in note section form an entity. Then after attached csv file in note section , whatever the data in csv file just insert  in to entity fields using plugin.

*This post is locked for comments

I have the same question (0)
  • tw0sh3ds Profile Picture
    5,600 on at

    Do you already have some code for a starting point? Which part are you having problem with? There are thousands examples on google on

    1) How to create a plugin in CRM 2016

    2) How to read document from an Annotation in CRM 2016

    3) How to read CSV file

    4) How to update record in CRM 2016

    Just put it all together and you will have your solution. Don't expect others to do all the job for you, how fun is it if you don't try to figure something out for yourself at first? If you already have and it's not working then post your code, we will be happy to help you make it work.

  • ggghj Profile Picture
    160 on at

    Ok,

    Can you please share some referral link.

  • tw0sh3ds Profile Picture
    5,600 on at

    As I said - there are thousands of links. Just copy paste to Google search each of the step that I posted and choose whichever you will find suitable and clear enough for you.

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

    Here are some links to help you start, but as Pawel mentioned, there are a lot of links your can search online:

    // Reading CSV file. You will have to modify reading for directory to reading from stream

    stackoverflow.com/.../reading-csv-files-using-c-sharp

    // MSDN Upload Retrieve and Download attachment

    msdn.microsoft.com/.../gg328429.aspx;MSPPError=-2147217396

    // MSDN Use Entity class for create update and delete

    msdn.microsoft.com/.../gg309731.aspx

  • ashlega Profile Picture
    34,477 on at

    You might actually try to re-use import functionality. There is an example here:

    https://msdn.microsoft.com/en-us/library/hh547396.aspx

    I think Aric has already provided you a link explaining the document attachments..

    https://msdn.microsoft.com/en-us/library/gg328429.aspx

  • ggghj Profile Picture
    160 on at

    I have a doubt about to get id of attached file in note section.

    Share with u code details , at the time click on ribbon button the attached csv file from note section carry data and insert it into entity fields.

    $('#infg.infg_mta.Button2.Button').on("click",function(e){

       e.preventDefault();

       $('#files').parse({

           config: {

               delimiter: "auto",

               complete: buildTable,

           },

           before: function(file, inputElem)

           {

               //console.log("Parsing file...", file);

           },

           error: function(err, file)

           {

               //console.log("ERROR:", err, file);

           },

           complete: function()

           {

               //console.log("Done with all files");

           }

       });

    });

    function buildTable(results){

       var markup = "<table class='table'>";

       var data = results.data;

       for(i=0;i<data.length;i++){

           markup+= "<tr>";

           var row = data[i];

           var cells = row.join(",").split(",");

           for(j=0;j<cells.length;j++){

               markup+= "<td>";

               markup+= cells[j];

               markup+= "</th>";

           }

           markup+= "</tr>";

       }

       markup+= "</table>";

       $("#app").html(markup);

    }

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