You need to sign in to do that
Don't have an account?
johnc82
Assignment Rules API from Custom Controller
I have a function in my controller that creates a new case record. I need this to go through the assignment rules. How can I do that with this?
public PageReference saveandcreateCase() { saveallobjects(); Case c =new case(); c.Opportunity__c=object.Opportunity__c; c.AccountId=object.opportunity__r.accountId; c.RecordTypeId='01240000000DkcD'; c.ContactId=UserContactId; insert c; object.Case__c=c.Id; PageReference createCaseReturntoObject= new PageReference('/apex/ObjectPage?Id=' + object.Id); createCaseReturntoObject.setRedirect(true); return createCaseReturntoObject; }
Here's a blog post explaining how to do that, courtesy of my fellow mod Ankit:
http://forceguru.blogspot.com/2011/12/case-assignment-rules-from-apex.html