Dec 8, 2011

Case Assignment Rules From Apex - Database.DMLOptions

This is really very important for users who use native cases with assignment rules.


I have assignment rule defined on Case which says if the "Status" of case is "New" then assign that case to "System Admin" (User in my organization)




Now when I insert a case manually with "Assignment using active assignment rules" checkbox checked then assignment rule works fine, and "System Admin" is assigned as the Case Owner.


Now I want to create the case from my apex code and also want assignment rules to be triggered. But the problem is we are not able to access the "Assignment using active assignment rules" checkbox in apex. Now am stuck because there is a lot of code already written for case insertion, so what is the solution for this?


This code :
Case newCase = new Case(Status = 'New') ;
insert newCase ;


inserts the case but assignment rules are not triggered so case owner in my scenario remains "Ankit Arora" and expected was "System Admin"






Solution is using Database.DMLOptions. Now before inserting the case I use Database.DMLOptions and with my case insertion assignment rules are also triggered, this is all what I want.


When I use this code :
//Fetching the assignment rules on case
AssignmentRule  AR = new AssignmentRule();
AR = [select id from AssignmentRule where SobjectType = 'Case' and Active = true limit 1];

//Creating the DMLOptions for "Assign using active assignment rules" checkbox
Database.DMLOptions dmlOpts = new Database.DMLOptions();
dmlOpts.assignmentRuleHeader.assignmentRuleId= AR.id;

Case newCase = new Case(Status = 'New') ;
newCase.setOptions(dmlOpts);
insert newCase ;


It inserts the case and my assignment rule which is in active state get fired and Case Owner becomes "System Admin"



83 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. It's more reliable to use the default option:

    Database.DMLOptions dmo = new Database.DMLOptions();
    dmo.assignmentRuleHeader.useDefaultRule= true;
    newCase.setOptions(dmo);

    Cheers
    Detlef

    ReplyDelete
  3. Do you have a test class for this?

    ReplyDelete
  4. My Assignment Services constantly aim to expand our base of assignment help and call in international experts who are ex-professors from reputed business schools, management schools, engineering universities from across the globe. this provides you with an opportunity to get a global and world perspective in your answers and lets you connect with a writer who understands you. My Assignment Services do not make empty promises and have always achieved what we promised our clients by online Do my assignment. If you need any academic consultation for any assignment type, our team of online assignment helper is available ready to cater to your needs any given moment. We are working round the clock and 365 days of the year. My Assignment Services is your first and last destination for every query you have related to ‘help my assignment’ because we guarantee you the lowest possible price of assignment help sydney with the unmatched quality of assignments in Australia.

    ReplyDelete
  5. Did anyone get a test class for the above code?

    ReplyDelete
  6. Writing a cese brief requires to know about the case brief structure and meet the requirements of your professor.
    Whether you are unfamiliar with the case brief structure or are not sure how to properly cite your work, you can read an article mentioned here.

    ReplyDelete
  7. This post will be helpful for those who are going to work on case assignment and also for the students who are looking for the assignment help.

    ReplyDelete
  8. Top Quality Cheap Assignment Help Services
    Need Assignment Help?

    We provide customized Assignment Help service. Our primary motive is not only to provide you cheap assignment help to make your journey smooth. The increasing importance of writing assignments has prompted students to take a helping hand from essay assignment help services. During higher studies in colleges, students often have to prepare multiple documents, quizzes, and surprise tests. This is the main reason why most students search for

    ReplyDelete
  9. Nice blog. Hire the trusted assignment help Australia company for your assignment help. Student Assignment Help never comprised of quality. Always deliver plagiarism free content to students.

    ReplyDelete
  10. Thanks for providing the information with this post. Post is very nice! By the way, I want to share with you information about the best. ganeshaspeaks best for astrology.

    ReplyDelete
  11. Any good book should adhere to those criteria according to which you will evaluate it. You can learn more about it by availing our evaluative essay writing help. The hand-picked persuasive essay writers of EssayAssignmenthelp.com.au are here to help you out. Would you like to burn the midnight oil to write the essay, or enjoy a sound sleep while we take care of your essay worries? We have 500+ highly qualified writers on board. They hail from the field of academics and are well-versed with the complications involved in writing an analytical essay.

    ReplyDelete
  12. Nursing is a subject which students might take into account challenging to try and do its assignment that too without any help. The team of Ideal Assignment help is all right aware of the challenges associate degreed trouble one goes through while making an assignment. Our Nursing profession is one in all the most famous professions in the world especially in developed countries like the us they providing best quality Nursing Assignment Help for you. If you want then Contact our expert team also visit our website.

    ReplyDelete
  13. Excellent information Providing by your Article, thank you for taking the time to share with us such a nice article. Amazing insight you have on this, it's nice to find a website that details so much information about different artists. Kindly visit the LiveWebTutors website we providing the best assignment help services in Australia.

    For More Info: Assignment Help Brisbane

    ReplyDelete
  14. I suggest all members choose MY assignment help Australia for the best guideline in your academia. The perfect and expert assistant your requirement and learning assignment project by the university.

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

    ReplyDelete
  16. My Assignment Help is the most preferred place to get assignment help Australia services where we offer 100% plagiarism free and money back guarantee ensuring complete satisfaction of students with every order. Our subject-specific experts are available 24x7 to provide properly formatted and referenced solutions in any subject from any level in Australian universities.

    My Assignment Help Australia

    ReplyDelete
  17. Kareer konncect is a leading software training institute providing Software Training, Project Guidance, IT consulting and Technology Workshops. Using our enhanced global software training delivery methodology, innovative software training approach and industry expertise, we provide high-value corporate training services that enable our clients to enhance business performance, accelerate time-to-market, increase productivity and improve customer service. More Info- Cpt Jobs in usa

    ReplyDelete
  18. I am experiencing QuickBooks Error Code H505 on a daily basis. QuickBooks is the efficient accounting tool that helps all business people to maintain the accounting entries in the simplified ways. This error code can display, while QuickBooks company file looks for some additional configuration.

    ReplyDelete
  19. What better way to help your customer than through a quick chat on your website?

    Add Free Live Chat Support Software for Website to Increase Your Sale, Customer Support, to Boost Your Online Business with -
    free chat software
    free live chat
    free live chat support
    100% free live chat support
    free live chat support software

    ReplyDelete
  20. I agree with the facts you stated above. You have a beautiful flow with words. For students who are struggling to write their assignments on their own, I suggest they choose the Resume Builder service of LiveWebTutors. It is a perfect and affordable platform that helps you to achieve top grades in your academic activities.

    ReplyDelete
  21. It was great for everyone and I realized that it was more amazing if you share more like this article, Thanks for your great topic sharing friend, i get new suggtions and, new tips to do somethings good luck. Assignment Help Sydney

    ReplyDelete
  22. Thanks for sharing such a piece of wonderful information. Moreover, it is very true that Entertainment company is ruling the world.
    There is everything fame, money but first, you need to set-up your brand availability. Promote your brand, gain customers’ trust, present what the audience wants,
    and you will be able to rule the entertainment company.
    entertainment company






    ReplyDelete
  23. Thanks for sharing such a piece of wonderful information.it is very true that payafter placement sounds little loud . and i ould prefere you to do visit
    this careerthrist for making and shaping up you . Payafter placement
    provide you a facility of paying your fees after completing you masters and bachlors both.




    ReplyDelete
  24. hanks for sharing such a piece of wonderful information. Moreover, it is very true that Entertainment company is ruling the world.
    There is everything fame, money but first, you need to set-up your brand availability. Promote your brand, gain customers’ trust, present what the audience wants,
    and you will be able to rule the entertainment company.
    entertainment company


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

    ReplyDelete
  26. Wowo these assignemnt rules will surely help me with my assignments with great ease and support of people Assignment provider as well as assignment help

    ReplyDelete
  27. The aim of our company is to provide professional custom essay writing service at cheap price. Our expert writers produce a non-plagiarized paper for you.
    Custom Assignment Writing

    ReplyDelete
  28. I really happy found this website eventually. Really informative and inoperative, Thanks for the post and effort! Please keep sharing more such blog.
    Homework Help Service

    ReplyDelete
  29. Welcome to City Call Girls, If you want a real girlfriend experience and wild energetic sexual satisfaction by Escorts in City then please contact us here we have many young and hot models, Russian Girls, VIP Call Girls in City are working as Call Girls in City. Contact us anytime we provide girls at your home or hotel on the best affordable rate.
    Kharghar Call Girls ##
    Versova Call Girls ##
    Kalyan Call Girls ##
    Wadala Call Girls ##
    Lokhandwala Call Girls ##
    Goregaon Call Girls ##
    Kandivali Call Girls ##
    Nalasopara Call Girls ##

    ReplyDelete
  30. Welcome to Andheri Escorts Service, If you want a real girlfriend experience and wild energetic sexual satisfaction by Escorts in Andheri then please contact us here we have many young and hot models, Russian Girls, VIP Call Girls in Andheri are working as Escorts Service in Andheri. Contact us anytime we provide girls at your home or hotel on the best affordable rate. Visit Our Partner Links:- http://www.modelnight.net/escort-in-andheri.html

    ReplyDelete
  31. Assignment Help on web is a brilliant service that has employed qualified writers to produce well researched and high-quality content. This service has a customer-centric refund, revision, and privacy policy. Their price plans are cheaper and affordable. So, if you have any concerns regarding your assignment, contact us immediately
    assignment help

    ReplyDelete
  32. Pogo Games Loading Problem / Java Games Not Working
    This is most common problem which most of the users face while playing Pogo Online games. The solution to this issues is available on many website.
    • Install latest version of Java
    • Enable new Java installation, restart Internet browsers.
    • Remove all previously installed Java versions.
    • Enable automatic updates on the devices.
    • Install correct version of Java.
    • Install Antivirus and Firewall on the device.
    • Always use Java supported Web browsers. Chrome 64-bit for Mac became available with Chrome Version 39. » More info Check system requirements to ensure any applets that uses Java will function properly.
    • Visit the Pogo website for more Java help and Pogo information
    For more information Visit: https://pogo-supportcenter.com/
    https://pogo-supportcenter.com/pogo-games-not-loading/
    pogo login , pogo support , pogo troubleshooter , pogo sign in screen , pogo account , club pogo member sign in , pogo sign in problems , pogo support number , pogo customer service phone number , pogo games support phone number , pogo support phone number

    ReplyDelete
  33. Good to read such an informative blog .I find it interesting and is pretty fascinating, By reading your blog i got very useful information.Thanks for sharing this blog. I recommend you to visit Web Application Development Company

    ReplyDelete
  34. Hey there, how can I avail of your Statistics Homework Help services? I need you to provide me with Statistics Assignment Help on partial correlation. You have to find the correlation of the dataset, and when you are done, you interpret the results. Contact me if you can perform it and tell me what I need to do to get you started.

    How do you determine what to charge for your programming homework help? I want a programming coursework help but I don’t know whether I am going to afford your services. That is the reason I first want to know how much you charge for it. If your charges are pocket friendly then I am going to hire you for one of my other four assignments where i will need a Java Homework Help. For my second assignment i will require a C++ Homework Help expert.For my third assignment i will require a C Homework Help with an all rounded knowledge on C language. For my last assignment i will need a Python Homework Help. I have sent an email requesting for a quotation, once you reply I will make an informed decision.

    ReplyDelete
  35. I would like to attend online classes. I have nothing to do at the moment other than watching football updates and spending a lot of time on the internet. It's time I should make use of this readily available time. It's not about doing my Statistics Assignment Help but just making this time useful. I hope I can get an experienced Statistics Homework Help tutor for this.


    If there was somewhere to provide feedback on the quality of your work I would be glad to provide one for your programming assignment help service. Since I have not seen any place then I am just going to write here. I loved how the programming coursework help lessons were handled. The python assignment help tutor you assigned me simplified programming for me and made me love it. He was available for daily tuition and never got tired of my never-ending questions and because of that i would love you to assign me a C++ Assignment help tutor who can make me understand C++ even better. I also have two other classmates who need assistance as well. One needs a Java Assignment help tutor because his grades were moving on a downward trend. The second one needs a C Assignment help tutor to make him understand this programming language even better.

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

    ReplyDelete
  37. Hello. I am looking for Physics homework help right now. I live in Australia but I will soon shift to New Zealand. I want to know whether you can also offer Accounting homework help to me. Since I am looking for quick services, I do not think the delay will be a good idea. If you can help me with this, I will also seek Matlab Assignment Help and Engineering homework help from you. Please let me know about your charges immediately and how I can hire your tutors at the earliest. I am waiting. Let me know immediately. So, I can score good grades in exams.

    ReplyDelete
  38. Hello. I am looking for Physics homework help right now. I live in Australia but I will soon shift to New Zealand. I want to know whether you can also offer Accounting homework help to me. Since I am looking for quick services, I do not think the delay will be a good idea. If you can help me with this, I will also seek Matlab Assignment Help and Engineering homework help from you. Please let me know about your charges immediately and how I can hire your tutors at the earliest. I am waiting. Let me know immediately. So, I can score good grades in exams.

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

    ReplyDelete
  40. A very excellent blog post. I am thankful for your blog post. I have found a lot of approaches after visiting your post Epson Printer Error Code 000041

    ReplyDelete
  41. Long Drive Tablet 60mg is a Sildenafil drug used to treat erectile dysfunction and impotency in men. Omsdelhi, a rising manufacturing company in the healthcare industry provides online delivery of Long Drive tablets 60mg with a discrete packaging. You can order the medicine from our website easily.

    ReplyDelete
  42. Get Best Data Analytics Assignment Help. Hire our experts today to boost your grades.My Assignment Help is suitable in developing a content of high-quality matter on the assignment provided to us. Our subject-specific experts have the required experience in the field that makes them far more suitable for the ask. we offer 24x7 Live Customer Help service answering your every dilemma regarding data analytics assignment help. Contact us now

    ReplyDelete
  43. I am happy to receive Stata assignment help from you as the expert made both ends meet to make the topics simpler. I was charged nominal and could finish my homework before the stipulated time. I will also recommend taking JMP assignment help and Gretl assignment help from this platform as they are renowned to handle and solve bulky homework in no time at all. Most importantly they are pocket-friendly as well.

    ReplyDelete
  44. We are offering Environmental Engineering assignment help to the students seeking after Environmental designing across US, UK, Canada and different spots across the globe. Simultaneously, we guarantee them to acquire amazing evaluations with the unrivaled quality writing support offered by our in-house writers. Our capable Environmental designing project help writers will make the academic papers in any event, for the most confounded points identified with Environmental designing.
    assignment provider
    assignment help melbourne

    ReplyDelete
  45. Are You Looking For Nursing Assignment Help? My Assignment Help has been the most preferred online nursing assignment help providers in Australia, U.S, UK, New Zealand, and UAE. With assignment help experts at My Assignment Help, 100% Plagiarism free content is guaranteed to customers. Our Writings are unique and written from scratch. We hire only most talented and expert writers and tutors.

    ReplyDelete
  46. Amazing post! The article shared by is highly informative.
    How To Buy Domain By Godaddy

    ReplyDelete
  47. Hello. Can you help me with my statistics homework this month? I have a lot going on in my career right now and I am unable to focus on this subject. Please help me by providing potential statistics homework help and engineering homework help telling me how to hire your online expert tutors immediately. I hope that your services are cost-effective because my friend told me you are highly affordable. If I get good grades from studying under you, I will undoubtedly recommend a friend.

    ReplyDelete
  48. Purchase Cob Led Downlights from Jainsons Lights. Other than decorative lights, we also offer various lighting variations. Today, you have got the choice to browse web shops and buy online. If you're still hesitant about purchasing lights online, you may want to contemplate the advantages and convenience that online shopping must offer.

    ReplyDelete
  49. Hi. Can you offer STATA Homework help & finance assignment help to me urgently? Since I am looking for your immediate services, I cannot wait to seek your service. Please, also let me know if you can do my statistics assignment for me this month as I am running out of time. I am also not keeping well. That is why I fear I will not be able to finish on time. If you help, it can be possible. So, please let me know. Thank you.

    ReplyDelete
  50. Hi. Can you provide statistics homework help to me right now? I am looking for urgent services from your end so please do not delay. My sister also wants to join your excel assignment help & math assignment help. Please enlighten me with your payment package and what the process of hiring your tutors looks like. I will join your team accordingly. Thank you for your time and support. In case you are unable to help at least recommend someone who can offer guidance to me.

    ReplyDelete
  51. Visiting Rajasthan by hiring Rajasthan Tour Packages would break the routine and create a bag full of memories and stories to share and remember after going back to a somewhat monotonous life most of us are leading these days. Take a short break and visit this amazing land of culture with Go Rajasthan Travel .

    ReplyDelete
  52. Searching for Mywifiext plan? We are here to help you. It is a web address for Netgear wifi extender plan. Get best help from us to Netgear WiFi Extender Setup. We have get-together of express specialists who can help you identified with your requesting.
    netgear support cost
    192.168.1.250
    netgear r6080
    netgear ex3700 setup wps
    Netgear WiFi Extender Setup
    mywifiextenders
    netgear router setup password
    mywifiext local
    netgearsupportcost

    ReplyDelete
  53. FantasyDangal has become one of the best fantasy cricket app. In a very short time, the FantasyDangal app has gained a lot of popularity. The app is available in nine languages and offers a range of bonuses and offers to users who want to play fantasy cricket, win cash, and stay in the game. The app also offers different modes such as Safe Play and Regular play that make it easy for users.
    Also read: Highest Partnership in IPL

    ReplyDelete
  54. Hi, Math is a tough course, and we completely understand. That is why we came up with Mathematics Online Exam Help. With us, you will receive Statistics Online Exam Help and Finance Online Exam Help in a smooth like butter manner. We are easy to get in touch with and we fashion a friendly environment for the students.

    ReplyDelete
  55. atiba university oyo post utme past questions pdfSo much happy to read this blog post, you have many information put together on this article and i really appreciate your effort in sharing it

    ReplyDelete
  56. I got a jumper for my boyfriend, a sexy jumper if you know what I mean. I got the idea from tiktok.wholesale blank apparel Got it for his birthday and was nervous about the print. Was amazed by the quality,

    ReplyDelete
  57. Digital marketing is a field with lucrative career options. The options in the career of digital marketing.

    After the pandemic period, digital marketing has emerged with a lot of opportunities across the globe.

    Currently, Delhi is now a great stop for digital marketers and many folks are looking forward to starting a career in digital marketing.

    Parallelly, there are digital marketing institutes that providing high quality training which are Top Digital Marketing Course in Delhi

    ReplyDelete

  58. If you need help with a business assignment, contact our Business Assignment Help consultants for the best guidance .Our consultants consistently offer complete and quite well business assignment solutions that are easily understandable and help students achieve top academic grades. Aside from that, our business assignments help providers provide a comprehensive review service at no extra charge.

    ReplyDelete
  59. Some students just need those tips on how to write their case study. Therefore, we are here to provide them with the best online case study writing help. We ensure that every student is getting the best guideline no matter case study writing help online their case study is If you are looking to solve your case study professionally then you are in the right place. There is nothing that we do not have to help out students. Our Case study assignment help will surely make your case study one of the best There are many students who do not have enough time college case study assignment write down their own case study assignments. This is why we are here. Our magical Help with case study assignment will make sure to bring you the best case study you have ever seen.

    ReplyDelete
  60. Remember to get a singing bowl or a prayer wheel for your house. To organize your shopping, look through the whole selection of Manali honeymoon packages. At Travelneeds, our specialists can help you plan a memorable Hyderabad to Manali Honeymoon Package.

    ReplyDelete
  61. Dangal Games is the best place for you to be entertained and to make some earnings with online real money games in India. Are you looking for a fun way to kill time and earn money through games? You can easily earn money playing games on DangalGames! There is a chance that you can play games and earn money in India.

    ReplyDelete
  62. Hi, I am John Smith I am Web Developer, It is an amazing blog thanks for the sharing the blog. Frantic infotech provide the java web development such as an information about software development for costumer service. Frantic infotech also provide the angularjs web development. Theve delopment of advanced web applications is Orient Software’s specialty and we will successfully fulfill all your web application development requirements, from small-sized to wider-ranged projects.

    ReplyDelete
  63. Very good! We hope this article has been informative for some people. If you are looking for this kind of information, then check out this profile morse code letter chart. It will be a great help while coding and decoding messages.

    ReplyDelete
  64. What Is Cash App Business Account And Do I Need To Pay Any Charges?
    Cash App Business Account
    is a kind of Cash App account and you will able tocater to your business needs without having to confront any kind of technical or non-technical issues.So, if you get a Cash App business account and you would like toaccept the payments without confronting any kind of hassle, you will have to pay a 2.5% while accepting the payment on your Cash App business account. For the right guide and information, go to the official help section right now.

    ReplyDelete
  65. I never take a moment to voice my opinion about it. You're doing well. Keep going. The jitter click method is utilized to get you the most clicks in the shortest amount of time, which is one benefit of being a gamer. To learn more, visit this blog on jitter click.

    ReplyDelete
  66. If you're suffering from any type of sexual diseases, then Vigora 50 Tablet 50mg is what you need. This tablet will not only cure the disease, but will also make you act like a lone wolf in bed and will make you 10x times younger than your age. You should consume this medicine as per recommendation by the doctor and if you are facing any issues click at Omsdelhi.

    ReplyDelete
  67. No other company can give us the benefits that our team has to offer. Our team not only offers various types of packages, but among all of them the Ladakh Trip Package from Kolkata is one of the best. Our trip includes all types of charges including the accommodation and food cost. For more details click at Naturecamp Travels.

    ReplyDelete
  68. Suhagra Force 50 Online is a combination of two medications used to treat adult men's premature ejaculation. It improves blood flow to the penis, assisting males in obtaining an erection. This medication should only be taken as directed by a doctor. Reach at Oms99 to know more details.

    ReplyDelete
  69. Discover the grandeur of Kumbhalgarh's fortifications and history through our expertly designed Kumbhalgarh Tour Packages. Explore the historical nuances of this Mewar stronghold and be captivated by its intricate architecture and panoramic views. Unveil the secrets of the Great Wall at Go Rajasthan Travel.

    ReplyDelete
  70. Unlock the complexities of MGT602 Business Decision Analytics Case Study 2 Sample with our tailored online assignment help. Our dedicated team of analysts and educators provides personalized support, detailed case study samples, and step-by-step guidance, enabling students to grasp the nuances of analytics-driven decision-making in the business sphere effectively. Elevate your learning experience with our assistance today

    ReplyDelete
  71. Ignite Speech is your dedicated partner in education at the Center for Special Education. Our specialized educators create a tailored learning experience, fostering academic success and a positive learning attitude. Visit us to discover inclusive and supportive education for individuals with unique learning needs.

    ReplyDelete
  72. Enhance your space with the timeless elegance of a Marble Buddha Statue from The Stone Studio. Handcrafted with precision and attention to detail, these statues radiate serenity and sophistication, making them perfect for homes, gardens, and meditation spaces. Explore our collection to find the ideal piece that reflects peace and harmony.
    https://www.thestonestudio.in/handicraft/buddha-statues/

    ReplyDelete