Case Assignment Using Apex Code

Requirement: When Case will insert using apex code assignment check box should be true.

Solution:

List<Case> lstofCase = new List<Case>();

Case objCase = new Case();

  ObjCase.status="New";
lstofCase.add(ObjCase);
Insert lstofCase;

 Database.DMLOptions dmo = new Database.DMLOptions();
  dmo.assignmentRuleHeader.useDefaultRule = true;
   system.debug(' dmo.assignmentRuleHeader.useDefaultRule***'+ dmo.assignmentRuleHeader.useDefaultRule);
 Database.update(lstofCase, dmo);


  Thanks,
Sumit Shukla
mob: 9711055997
skypeID: shuklasumit1
email ID: sumitshukla.mca@gmail.com


Comments

Popular posts from this blog

Salesforce Spring 16 Release Exam (Maintenance Exam Q&A) for Developer 201 Admin

Show Hyper Link On Add Error in Salesforce Trigger

Show the Success Message before Redirecting the Detail page on Visualforce Page