You need to sign in to do that
Don't have an account?
tes
DMLOptions not triggering Territory Assignment
Hello,
In the example code below using DMLOptions the territory assignment will not refresh on update. Has anyone else had any crack at this new functionality?
Also I have beforeInsert triggers being executed too, could it have any impacted the SOAP headers or do the DMLOptions get carried over in the trigger update?
Please advise,
Tom
--sample code--
...
public sobject Obj
public PageReference Save() {
onSave=true;
system.debug(Obj);
GeoAddress.writeto(Obj,useSecondaryAddress);
//as of v.15 we can se the assignmentRuleHeader via APEX
//this illiminates the need for a Ajax callback.
Database.DMLOptions dmo = new Database.DMLOptions();
dmo.assignmentRuleHeader.useDefaultRule= true;
Obj.setOptions(dmo);
system.debug(dmo);
update Obj;
PageReference page = new PageReference('/'+objectId );
page.setRedirect(true);
return page;
}
debug log:
...
20090128205240.909:Class.ctrlAddressVerifier.Save: line 250, column 9: Account:{ShippingCountry=USA, ShippingStreet=1407 Blalock Rd, ShippingAddressAccuracy__c=L1AAA, ShippingCounty__c=Bogus County, Country__c=UNITED STATES, ShippingState=TX, ShippingFIPS__c=48201, Name=A-1 Paint Body Shop, SubRegion__c=United States, ShippingLatitude__c=29.79548000, Region__c=North America, ShippingCity=Houston, Id=0013000000Lyfx3AAB, ShippingPostalCode=77055-4413, ShippingLongitude__c=-95.52337300}
20090128205240.909:Class.Geography.GeoAddress.writeTo: line 371, column 13: returning from end of method public void writeTo(SOBJECT:Account, Boolean) in 1 ms
20090128205240.909:Class.Geography.GeoAddress.writeTo: line 364, column 70: returning from end of method public void writeTo(SOBJECT:Account, Boolean) in 2 ms
20090128205240.909:Class.ctrlAddressVerifier.Save: line 251, column 9: returning from end of method public void writeTo(SObject, Boolean) in 2 ms
20090128205240.909:Class.ctrlAddressVerifier.Save: line 258, column 9: Database.DMLOptions:[AllowFieldTruncation=null, AssignmentRuleHeader=Database.DMLOptions.AssignmentRuleHeader:[AssignmentRuleId=null, UseDefaultRule=true], EmailHeader=null, LocaleOptions=null, OptAllOrNone=null]
20090128205240.909:Class.ctrlAddressVerifier.Save: line 260, column 9: Update: SObject
*** Beginning trigAccountCountryValidation on Account trigger event BeforeUpdate for 0013000000Lyfx3
All Answers
No Dice, still no assignment was triggered.
RE:
public PageReference Save() {
onSave=true;
system.debug(Obj);
Account acc = (Account) Obj;
GeoAddress.writeto(acc,useSecondaryAddress);
Database.DMLOptions dmo = new Database.DMLOptions();
dmo.assignmentRuleHeader.useDefaultRule= true;
acc.setOptions(dmo);
system.debug(dmo);
update acc;
PageReference page = new PageReference('/'+objectId );
page.setRedirect(true);
return page;
}
Can you please update the following ideas post given that this was not part of Spring 09?
http://ideas.salesforce.com/article/show/10094798/Expose_Running_Territory_Rules_in_Apex
Can anybody tell me if using DMLOptions triggers Territory Assignment rules in the Summer'09 release? I've read the new version of apex_language_reference document and it still says the same:
The database.DMLOptions object supports assignment rules for cases and leads, but not for accounts or territory
management.