You need to sign in to do that
Don't have an account?
DatabaseDMLOptions Error
Has anyone used DatabaseDMLOptions?
When creating a case via a visualforce page with standard and extension controller, I would like the default assignment rule to fire.
I cut and paste the following out of the documentation as shown here:
DatabaseDMLOptions dmo = new Database.DMLOptions();
dmo.assignmentRuleHeader.useDefaultRule= true;
and pasted it in my code as :
DatabaseDMLOptions dmo = new Database.DMLOptions();
dmo.assignmentRuleHeader.useDefaultRule= true;
Case c = new Case();
c.SuppliedName = 'myName';
c.SuppliedEmail = 'my@emailaddy.com';
c.SuppliedCompany = 'myCompany';
c.setOptions(dmo);
insert c;
---
When I try to save this version of the code in Eclipse, it moans about the second line, with the following: "Save error: unexpected token: dmo.assignmentRuleHeader.useDefaultRule".
So then I checked the class itself, and it is saved against API version 15. I can't see how I've done anything wrong since I cut and pasted the thing exactly as in the documentation.
And don't you mean
Database.DMLOptions dmo = new Database.DMLOptions();
You're missing the . in that first word there.
It's still moaning at the same thing, the second line,.
Whether it's
Database.DMLOptions dmo = new Database.DMLOptions();
dmo.assignmentRuleHeader.assignmentRuleId= '<with rule Id here>';
or
Database.DMLOptions dmo = new Database.DMLOptions();
dmo.assignmentRuleHeader.useDefaultRule= true;
By the way, what do you guys do if you put up a query like this and nobody has an answer, like in this situation?
I thought of the v14 problem. In Eclipse, I only get the option of v14 even though I just updated it in the last week and a half.
So I fired up my browser and logged in to the development org I use. I went through setup to the classes area and sure enough, it says v15 there. That's what prompted me to post in the first place. So I decided to edit the class right there through the UI and uncomment the problem lines and save. And I still get the same error.
I was really hoping there was some little stupid error I was making.