• tes
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
 
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
  • January 28, 2009
  • Like
  • 0