2

I'm trying to assign DML options to an account's update. It's working with the insert, but not wit an update.

Here is the code I'm using:

Database.DMLOptions dmlOpts = new Database.DMLOptions();
dmlOpts.assignmentRuleHeader.useDefaultRule = true;
List<Account> accs = [SELECT Id FROM Account LIMIT 10];
Database.update(accs,dmlOpts);

After running that, no territory rules are running. I know how to do it with Visualforce, but no idea using just APEX (as I really need).

Thanks!

2

From the docs at http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_dml_database_dmloptions.htm

The Database.DMLOptions object supports assignment rules for cases and leads, but not for accounts or territory management.

The correct assignment on insert must be based on some default value being set?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.