Error Class

Represents information about an error that occurred during a DML operation when using a Database method.

Namespace

Database

Usage

Error class is part of SaveResult, which is generated when a user attempts to save a Salesforce record.

See Also

Error Methods

The following are methods for Error. All are instance methods.

  • getFields()
    Returns an array of one or more field names. Identifies which fields in the object, if any, affected the error condition.
  • getMessage()
    Returns the error message text.
  • getStatusCode()
    Returns a code that characterizes the error.

getFields()

Returns an array of one or more field names. Identifies which fields in the object, if any, affected the error condition.

Signature

public String[] getFields()

Return Value

Type: String[]

getMessage()

Returns the error message text.

Signature

public String getMessage()

Return Value

Type: String

getStatusCode()

Returns a code that characterizes the error.

Signature

public StatusCode getStatusCode()

Return Value

Type: StatusCode

Usage

The full list of status codes is available in the WSDL file for your organization (see Downloading Salesforce WSDLs and Client Authentication Certificates in the Salesforce online help.)