Newer Version Available
UpsertResult Class
Namespace
Usage
An array of Database.UpsertResult objects is returned with the upsert database method. Each element in the UpsertResult array corresponds to the sObject array passed as the sObject[] parameter in the upsert Database method; that is, the first element in the UpsertResult array matches the first element passed in the sObject array, the second element corresponds with the second element, and so on. If only one sObject is passed in, the UpsertResults array contains a single element.
UpsertResult Methods
The following are methods for UpsertResult. All are instance methods.
getErrors()
Signature
public Database.Error[] getErrors()
Return Value
Type: Database.Error []
getId()
Signature
public ID getId()
Return Value
Type: ID
Versioned Behavior Changes
In API version 53.0 and later, the method returns the sObject ID. However, if record locking fails during the update operation, the method returns a null value.
In API version 52.0 and earlier, the method returned a null value if the record wasn’t updated successfully.
isCreated()
Signature
public Boolean isCreated()
Return Value
Type: Boolean
isSuccess()
Signature
public Boolean isSuccess()
Return Value
Type: Boolean