DBResultItem


DBResultItem

Class stores unified DB operation result for one SObject record.

record

Represents a generic SObject record in Salesforce.

Signature:

new DB.DBResultItem().record;

errors

List of the Database.Error objects which describe issues related with the operation context.

Signature:

new DB.DBResultItem().errors;

sendErrors

List of the Messaging.SendEmailError objects which describe issues related with the operation context.

Signature:

new DB.DBResultItem().sendErrors;

hasErrors

Determines if DB operation failed.

Signature:

new DB.DBResultItem().hasErrors;

DBResultItem()

Default Constructor.

Signature:

new DB.DBResultItem();

DBResultItem(SObject record)

Constructs a new DBResultItem with the given SObject record and an empty error list

Signature:

new DB.DBResultItem(SObject record);

Parameters:

  • record - the SObject record to be stored in this DBResultItem.

DBResultItem(SObject record, Database.Error[] errors)

Constructs a new DBResultItem with the given SObject record and an list of errors.

Signature:

new DB.DBResultItem(SObject record, Database.Error[] errors);

Parameters:

  • record - the SObject record to be stored in this DBResultItem.
  • errors - the list of errors associated with the record

DBResultItem(Messaging.SendEmailError[] errors)

Constructs a new DBResultItem with the given send email errors.

Signature:

new DB.DBResultItem(Messaging.SendEmailError[] errors);

Parameters:

  • errors - an array of Messaging.SendEmailError objects.

addError(String message)

Adds the error message to record from operation context.

Signature:

new DB.DBResultItem.addError(String message);

Parameters:

  • message - the error message to be added.

getErrorMessage()

Returns a concatenated string of error messages from both Database.Error and Messaging.SendEmailError objects.

Signature:

new DB.DBResultItem.getErrorMessage();

Return:

A string of error messages separated by semicolon (;).