Quantcast
Channel: Forum CRM Development
Viewing all articles
Browse latest Browse all 1000

Execute in batches

$
0
0

Hi,

I am learning data import process through CRM 2013 sdk. I was able to import and create records in CRM(1 by 1 import). I would like to know how can I leverage my code to execute the same in batches. Here is my code snippet.. someone please guide me on leveraging this code. Thanks in advance.

static void Main(string[] args)
        {
            var crmService = CRMHelper.GetCRMService();

            //local folder path for testing
            DataTable encounters = GetDataTableForCSV("C:\\temp\\","import.csv");

             foreach (DataRow rowItem in encounters.Rows)
             {
                 Entity incident = new Entity("incident");

                 incident.Attributes["new_id"] = (string)rowItem["Id"].ToString();
                 incident.Attributes["new_caption"] = (string)rowItem["Caption"].ToString();

//all the other field transformations goes here
Guid customerid = new Guid("{50H80DF3-7654-E433-9456-0029820G6434}");
                 EntityReference CustomerId = new EntityReference("contact", customerid);
                 incident["customerid"] = CustomerId;


                 //Create incident
                 crmService.Create(incident);
}
}







Viewing all articles
Browse latest Browse all 1000

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>