function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sathia Aran 9Sathia Aran 9 

DMLOptions not working for upsert operation

I added the below lines of code for upsert operation to record the duplicate record set.But I face compile time error .Please note that the dmloptions work for database.insert and database.update.Please help
Lines of Code:
Database.DMLOptions dml1 = new Database.DMLOptions();
  dml1.DuplicateRuleHeader.AllowSave = true;
  Database.upsert(lstOfEqup1, dml1);

Error message :
Method does not exist or incorrect signature: void upsert(List<Account>, Database.DMLOptions) from the type Database  
 
SFDC Dev 2269SFDC Dev 2269
DMLOptions  can be used for insert/update but upsert operation does not accepts DMLOptions as a parameters. Following is the format for the upserting list of records:

public static Database.UpsertResult[] upsert(sObject[] recordsToUpsert, Schema.SObjectField externalIdField,Boolean allOrNone)

Refer the following link for more information:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_database.htm
Mat JaggardMat Jaggard
Whilst that technically answers the question, it doesn't answer the real question which is how can you perform an upsert where you don't care about duplication of email address or whatever field it is that Salesforce is helping itself to an opinion on?
venkat rvenkat r
I don't think there's an option to use DMLOptions with Database.upsert . The above response from SFDC DEV 2269 does not answer the question.