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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Processing more than 5000 records using CRM SDK

(0) ShareShare
ReportReport
Posted on by 121

Hi guys, 

I want to update around 7000 records using CRM SDK. I have tried this paging method, but still getting only 5000 records updated. 

int success = 0;
            int failed = 0;
            int recordCount = 0;
            int recordProcessing = 1;
            int pageNumberAmpli =1 ;
            
            QueryExpression query_amplifier = new QueryExpression("lnkt_amplifiercode");
            query_amplifier.Criteria = new FilterExpression();
            query_amplifier.ColumnSet = new ColumnSet(true);
            //query_amplifier.Criteria.AddCondition("lnkt_itcode", ConditionOperator.Equal, "BKB8291000");
            query_amplifier.PageInfo = new PagingInfo();
            query_amplifier.PageInfo.Count = 5000;
            query_amplifier.PageInfo.PageNumber = pageNumberAmpli;
            query_amplifier.PageInfo.PagingCookie = null;
            query_amplifier.PageInfo.ReturnTotalRecordCount = true;
            query_amplifier.Criteria.AddCondition("modifiedon", ConditionOperator.LastXMonths, 4);
            //OrderExpression order = new OrderExpression();
            //order.AttributeName = "lnkt_name";
            //order.OrderType = OrderType.Ascending;

            EntityCollection amplifier_colect = new EntityCollection();

            amplifier_colect = service.RetrieveMultiple(query_amplifier);
           

            do
            {
                //UPDATE SCRIPTS
            }   
            while (amplifier_colect.MoreRecords);
            {
                Console.WriteLine("\n****************\nPage number {0}\n****************", query_amplifier.PageInfo.PageNumber);
                Console.WriteLine("#\tMigrating Amplifier");
                Console.WriteLine("Total Records Processing Per Batch: "   recordProcessing);
                Console.WriteLine("Number of Success: "   success);
                Console.WriteLine("Number of Failed : "   failed);
                query_amplifier.PageInfo.PageNumber  =1;
                query_amplifier.PageInfo.PagingCookie = amplifier_colect.PagingCookie;

                recordProcessing = 0;
                success = 0;
                failed = 0;

            }

Can you help me if there any mistake within my code ?

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    Place

    amplifier_colect = service.RetrieveMultiple(query_amplifier);

    to

    "do" loop.

  • Suggested answer
    Johao Larios Profile Picture
    1,795 on at

    Hello there,

    have you already tried with execute multiple?

    docs.microsoft.com/.../use-executemultiple-improve-performance-bulk-data-load

    docs.microsoft.com/.../api-limits

  • Suggested answer
    Nishant Rana Profile Picture
    11,325 Microsoft Employee on at

    This should help

    nishantrana.me/.../

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 83 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

#3
#ManoVerse Profile Picture

#ManoVerse 40

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans