Saturday, March 20, 2021

System.TypeException: Cannot have more than 10 chunks in a single operation

 While working on requirement where we have to perform DML on multiple object dynamically by using sobject, we got below error:


"System.TypeException: Cannot have more than 10 chunks in a single operation. Please rearrange the data to reduce chunking."


This kind of error appears if your list of sobject contains more than 10 types of object records or record of objects are not ordered based on object. For example if you are adding lead, account and contact record to sobject list by using below format:

Lead1,Account1,Contact1,Lead2,Account2,Contact2,Lead3,Account3,Contact3,Lead4,Account4,Contact4

This will be considered as 12 chunks on sobject and while performing DML, you will get this error.

If you want to avoid it, then rearrange the records in below format:

Lead1,Lead2,Lead3,Lead4,Account1,Account2,Account3,Account4,Contact1,Contact2,Contact3,Contact4

This sequence of records will be considered as 3 chunks and is allowed in single DML operation.

Execute below script and you will get this error:

List<sObject>  sbList=new List<sObject>();

for(integer i=0;i<10;i++){

    sblist.add(new Lead(lastname='Test Leat'+i,company='test company'+i));

    sblist.add(new Account(name='Test Account'+i));

    sblist.add(new Contact (lastname='test name'+i,email='test@gmail.com'+i));

}

insert sblist;



Ways to resolve this kind of error:

  • Rearrange the records in list so that all records belonging to one object are stored together in list.

List<sObject>  sbList=new List<sObject>();
for(integer i=0;i<10;i++){
    sblist.add(new Lead(lastname='Test Leat'+i,company='test company'+i));
}
for(integer i=0;i<10;i++){
    sblist.add(new Account(name='Test Account'+i));
}
for(integer i=0;i<10;i++){
    sblist.add(new Contact (lastname='test name'+i,email='test@gmail.com'+i));
}
insert sblist;

  • Sort the sobject list before performing DML

List<sObject>  sbList=new List<sObject>();
for(integer i=0;i<10;i++){
    sblist.add(new Lead(lastname='Test Leat'+i));
    sblist.add(new Account(name='Test Account'+i));
    sblist.add(new Contact (lastname='test name'+i,email='test@gmail.com'+i));
}
sblist.sort();
insert sblist;

Hope this will help!!




25 comments:

  1. Wow i can say that this is another great article as expected of this blog. Bookmarked this site..

    ReplyDelete
  2. System.TypeException: Cannot have more than 10 chunks in a single operation. Please rearrange the data to reduce chunking."
    Ardamax Keylogger serial key

    ReplyDelete
  3. Do you need Finance?
    Are you looking for Finance?
    Are you looking for a money to enlarge your business?
    We help individuals and companies to obtain loan for business
    expanding and to setup a new business ranging any amount. Get a loan at affordable interest rate of 3%, Do you need this cash/loan for business and to clear your bills? Then send us an email now for more information contact us now via Email:financialserviceoffer876@gmail.com whats-App +918929509036

    ReplyDelete
  4. Toning your body for summer is necessary for the good beach days, but what about staying fit for the entire year? What if you get one shop stop that offers you sports training, aerobic classes as well as la fitness signature club

    ReplyDelete
  5. BINARY SCAM RECOVERY

    ❌ Binary Option, Forex and their likes are a means of making money but it’s more like gambling. There are no sure means to guarantee that a person could make profit with them and that’s why it can also be reasoned to be scam. Let’s not forget that some individuals even give you �� % guarantee of making profits and end up running away with your money. The internet today is full of Binary Option Recovery Scam, you see so much testimonies been shared about how a firm or Company helped them recover what they lost to Binary Options. But believe it, it’s just a way to lure more people and end up scamming them.

    ❌ You might have also come across some individuals that say they will give you guarantee on successful trades but they only end up as SCAMMERS as well. You here them say stuffs like 200% guaranteed in just 2 weeks and when you go into trade with them, they start telling you to pay profits percentage before you can get your income. These are all liars please avoid them. But if you have been a victim of this guys, then you should contact FIRMWARE now‼️

    ✳️The big Question is “Can someone Recover their money lost to Binary Option and Scam⁉️
    I will say yes, and will tell you how.

    The only way to Recovery your money back is by hiring HACKERS to help you break into the Firms Database Security System using the information you provide them with, Extract your file and get back your money. It seems like a really impossible thing to do, I will tell you, it should be impossible, but with the use of specially designed softwares known to HACKERS and Authorities (such as The FBI, CIA e.t.c) it is possible and the only way to recover your money.

    ✅FIRMWARE are a group of hackers who use their hacking skill to hunt down SCAMMERS and help individuals recovery their money from Internet SCAMMERS.
    We just need the contact details of the SCAMMERS and Paymnet Info and within 4-8 hours your money will be return to you.

    ✳️ You can contact us via the emails below-:
    firmwarehacks@gmail.com


    We also provide Legit Hacking Services such as-:
    ��Phone Hacking/Cloning
    ��Email Hacking & Password Recovery
    ��Social Media Hacking & Passowrd Recovery
    ��Deleted Files Recovery ��Mobil Tracking
    ��Virus detection & Elimination.

    Email-: firmwarehacks@gmail.com




    Firmware
    2022 © All Right Reserved.

    ReplyDelete
  6. ☑️☑️COMPOSITE CYBER SECURITY SPECIALISTS ☑️☑️

    Do you seek the Best Legit Professional Hackers online?
    Congratulations Your search ends right here with us. •• ⚡️⚡️

    ☑️☑️For Years Now We have Been helping companies secure their Infrastructures against malicious Attacks, however private individuals have been making use of our services to provide Optimum solutions to their cyber and Hacking related Issues by providing them unlimited Access to their desired informations from their Target such as Phone Hack (Which enables them to monitor their kids/wife/husband/boyfriend/girlfriend, by gaining access to everything they are doing on their phone without their notice), Credit Card Mishaps, Website Hacking, Funds Recoveries And Every Other Cyber Related Issues That has to Do With HACKING.

    ☑️☑️COMPOSITE CYBER SECURITY SPECIALISTS is a vibrant squad of dedicated online hackers maintaining the highest standards and unparalleled professionalism in every aspect.
    We Are One Of The Leading Hack Teams In The United States With So Much Accolades From The Deep Web And IT Companies. ••
    ••We Offer Varieties Of LEGIT Hacking Services With the Help Of Our Root HackTools, Special HackTools and Our Technical Hacking Strategies Which Surpasses All Other Hackers.

    ☑️ Below Is A Full List Of Our Services:
    ▪️ FUNDS RECOVERY ON BITCOIN SCAM, INVESTMENTS, BINARY OPTIONS TRADING and ALL TYPES OF SCAMS.
    ▪️ WEBSITE AND DATABASE HACKING ��
    ▪️ CREDIT REPAIR. ��
    ▪️ PHONE HACKING & CLONING (giving you �� Unnoticeable access to everything Happening on the Target’s Phone)
    ▪️ CLEARING OF CRIMINAL RECORDS ❌
    ▪️ SOCIAL MEDIA ACCOUNTS HACKING ��
    ▪️RECOVERY OF DELETED FILES ��
    ▪️LOCATION TRACKING ��
    ▪️BITCOIN MINING ⛏ And lot More.


    ☑️We have a team of seasoned PROFESSIONALS under various skillsets when it comes to online hacking services. Our company in fact houses a separate group of specialists who are productively focussed and established authorities in different platforms. They hail from a proven track record and have cracked even the toughest of barriers to intrude and capture all relevant data needed by our Clients. Some Of These Specialist Includes ⭐️ DAWID CZAGAN⭐️ JACK CABLE ⭐️ SEAN MELIA ⭐️ ARNE SWINNEN ⭐️And More. All you Need To do is To Write us a Mail Then We’ll Assign any of These Hackers To You Instantly.

    ☑️COMPOSITE CYBER SECURITY SPECIALISTS is available for customer care 24/7. Feel Free to Place your Requests.

    ☑️☑️CONTACT:
    ••• Email:
    Compositehackers@protonmail.com

    ��2022© composite cybersecurity specialists
    ��Want faster service? Contact us!
    ��All Rights Reserved ®️









































































    ReplyDelete
  7. I am a living testimony of change. I can safely say that i have been blessed and my life transformed from being just a company attendant to a business owner all in the space of 1 month after i got my return on investment from davidbenjaminexptrader@outlook.com I did try some other trader but i got scammed. I am using this medium to reach out to the world for those who got plans to go bigger and better in life to contact this company via davidbenjaminexptrader@outlook.com or on WhatsApp +1 408 500 0775
    asap for certified and trusted services.

    ReplyDelete
  8. Visual Hacker that always gives a perfect job I needed a Hacker who can help me to recover my investment plans, When they denied me the withdrawal of my investment, I saw a testimony about a Great Visual Hacker called GHOST CHAMPION HACKER so I contact him on GHOSTCHAMPIONWizard (at) Gmail dot com. He asks for the necessary information and I send it to him within a maximum of 48hours he was able to give me all the breakdown of my funds and he recovered my funds successfully were able to purchase my dream house and I want everyone to contact him GHOSTCHAMPIONWizard@GMAIL.COM for various type of Hacking. Mobile spy, Phone Hacking, Bitcoin Hacking, Account Hacking, Snapchat Hacking, Instagram Hacking. He is the perfect HACKER

    ReplyDelete
  9. What would I have done without your help Mr White? I am most grateful and I am writing a review for you with a grateful heart. Thanks for helping me getting my life back together and especially helping me to clear my credit debts that my wife had maxed out and even more thanks for helping get the proof I need to go through with the courts. My wife has always been a cheater and I never would have had helped without you, she would have took away my children and all my money. If you are looking to hire a good cyber genius he is the man for you and you contact him here WHITEHATSTECH AT GMAIL DOT COM

    ReplyDelete
  10. I just have to introduce this hacker that I have been working with him on getting my credit score been boosted across the Equifax, TransUnion and Experian report. He made a lot of good changes on my credit report by erasing all the past eviction, bad collections and DUI off my credit report history and also increased my FICO score above 876 across my three credit bureaus report you can contact him for all kind of hacks . Email him here support@wavedrive.tech go on their website wavedrive.tech for more details,Whatsapp No:+14106350697 if you want to chat them up,One thing i can assure you would not regret this at all he is 100% legit

    ReplyDelete
  11. The world is filled with uncertainties, but obtaining a fake UK passport online is not one of them. 5 SIMPLE TECHNIQUES TO OBTAIN A VALID UK PASSPORT FOR TRAVEL PURPOSES Passports are important as they serve as a means of identification and also help you travel out of the country free from immigration restrictions.We have been online for a numerous years to help the movement between one country to another especially UK as most loved by many.

    ReplyDelete
  12. Quickbooks Customer Service +1 888-471-2380 is a fantastic accounting software that helps you with your finances.

    ReplyDelete
  13. Nice Post!

    Try Now The Best Baton Rouge Louisiana Catering Company because we are giving the best services for your wedding and special occasion.

    Know More: - Affordable Catering New Orleans Louisiana

    ReplyDelete
  14. At Delorean Bin Hire, We work dilligently to remove the wastes to the appropriate locations of the city. We are proud to say the we are the number 1 Waste Disposal Melbourne.

    ReplyDelete
  15. Very good quality. I am surprised how many attempts you set to make such an excellent informative website.

    ReplyDelete
  16. Shapoorji Pallonji BKC 28 opulent house advanced place, preferred city delivers well going to make amenities in Mumbai city premium and living resident apartment and flats. If the user requires the greatest luxury flat in Bombay, they could go to Shapoorji Pallonji BKC 28. invest in a project
    For More Information call us: - 022- 48934298
    Visit: - https://www.shapoorjipallonji.ind.in/shapoorji-pallonji-bkc-28/

    ReplyDelete
  17. It's just awesome. I will share this with my friends too.
    If you searching for authentic trending news articles
    Just click on:
    pakistan it companies
    advertising agencies
    company for digital marketing

    ReplyDelete
  18. Nice blog
    once check mine too
    Franchise in India

    Tea Time started in 2016 in Rajahmundry. Now it is having 3000+ Outlets all over India.The business model of franchise in India has attracted attention for its low-risk benefit. It is a quick and convenient way to start a business minus the excessive risk and complexity. Many companies have started to use the strategy of franchise in India to enhance their business appeal and increase company presence. The strategy is appropriate considering the rising demand for business enthusiasts to take the first step with minimal risk. However, the amount of investment often deters the franchisees from making the initial investment. Tea Time understands the problem and therefore focuses on less investment. Any middle-class family can easily afford and purchase a franchise to start a Tea Time Group franchise in India. Tea Time provides the startup kit that includes necessary movable equipment and the initial stock to start the business, along with marketing aid. So, anybody can start a business without much doubt.

    ReplyDelete
  19. Excellent article. Very interesting to read. I really love to read such a nice article. Thanks! keep rocking.customized erp.

    ReplyDelete
  20. Hello Madam and Sir
    Your serious and honest loan offer
    The loan varies from 5,000 to 1,500,000 euros and the documents are available to us, please contact me by email: financialserviceoffer876@gmail.com whats-App +918929509036

    ReplyDelete
  21. DeFi exchange hacks and cryptocurrency theft is growing like wildfire and at this rate even the most secure companies and accounts are getting hacked. If you have fallen victim to such con artists you can file a complaint and open a case with smart contract audit firm h4ck@thehackerspro.com
    and get your cryptocurrency recovered. They are a top notch recovery company based in Beverly hills and very trusted by clients from around the world. i have just detached the first part of 24.7 btc from the outsourced leveraged wallets. now im waiting for the Ethereum gas fee to come through so i can move to my binance before exchanging to fiat

    ReplyDelete
  22. This comment has been removed by the author.

    ReplyDelete
  23. Looking for a reliable Lenovo laptop service center in Delhi? Find authorized service centers with skilled technicians and genuine parts for all your Lenovo laptop repair and maintenance needs.
    Lenovo Service Center in Delhi

    ReplyDelete