You need to sign in to do that
Don't have an account?
Tej
database.upsert and save result
i am using database.upsert to update/insert a large volume of records into salesforce assuming that database.upsert have the advanatge - if one record in the bunch errors out, the rest of the operation will continue.
but its not the case, if one record fails the whole transaction is failing.
and also using the save result method is there any way i can capture which records are failing and send an email or something.
these records are coming from an external system.
Can you ensure that the opt_allOrNone option is set to "false"?
Usually it is set to false by default alreaday, but just to double-check.
Database. UpsertResult[] contains the result of an upsert DML operation returned by theDatabase.upsertmethod.:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_database_upsertresult.htm
You can iterate through this list and see which record had errors or not by for example checking if getId() is empty or not.
TRUE = Commit the change only when "ALL" records processed successfully.
FALSE = Commit the change only for the records which processed successfully.
So, to solve your issue, please mention third paramenter in upsert() as 'false'