5

This is specifically dealing with custom Visual Force controllers that do data validation and error checking prior to attempting to save records via a DML statement. During our validations we will populate custom Field and Page error messages. However, there are times when Salesforce will apply their own validation rules prior to our validation checks running. This generally occurs on Email fields and Text Area fields when the user supplied data does not meet the field requirements. Specifically, Salesforce will add a field error of "Error: Invalid Email Address." if the data entered does not include an "@" or a ".". For Text Area, we are getting "Error: Cannot user more than 1,500 characters." if users paste in a response exceeding 1,500 characters.

We don't have a problem with this behavior, but we would like to standardize our Requirements Documents around Error Messages. We are attempting to find a list of all of Salesforce's Standard field validation error messages so that we can incorporate them into our Requirements process.

Googling has yet to yield any meaningful answer. I can't find it in the SOAP or APEX Developer guides.

Does anyone out there have a list of the Standard Error messages generated by Salesforce for field validation errors?

1

1 Answer 1

6

The strings are version and language dependent. However, there is a way to find which codes are valid for a particular release: go into Setup > Develop > API, generate the Enterprise WSDL, and find the StatusCode simpleType. In version 39.0, in my org, it looks like the following values apply. The actual value that will be output depends on the user's language settings. You can use the getDmlType method to determine which type of error it was, regardless of the user's language settings.


ALL_OR_NONE_OPERATION_ROLLED_BACK ALREADY_IN_PROCESS APEX_DATA_ACCESS_RESTRICTION ASSIGNEE_TYPE_REQUIRED AURA_COMPILE_ERROR BAD_CUSTOM_ENTITY_PARENT_DOMAIN BCC_NOT_ALLOWED_IF_BCC_COMPLIANCE_ENABLED CANNOT_CASCADE_PRODUCT_ACTIVE CANNOT_CHANGE_FIELD_TYPE_OF_APEX_REFERENCED_FIELD CANNOT_CHANGE_FIELD_TYPE_OF_REFERENCED_FIELD CANNOT_CREATE_ANOTHER_MANAGED_PACKAGE CANNOT_DEACTIVATE_DIVISION CANNOT_DELETE_GLOBAL_ACTION_LIST CANNOT_DELETE_LAST_DATED_CONVERSION_RATE CANNOT_DELETE_MANAGED_OBJECT CANNOT_DISABLE_LAST_ADMIN CANNOT_ENABLE_IP_RESTRICT_REQUESTS CANNOT_EXECUTE_FLOW_TRIGGER CANNOT_FREEZE_SELF CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY CANNOT_MODIFY_MANAGED_OBJECT CANNOT_PASSWORD_LOCKOUT CANNOT_POST_TO_ARCHIVED_GROUP CANNOT_RENAME_APEX_REFERENCED_FIELD CANNOT_RENAME_APEX_REFERENCED_OBJECT CANNOT_RENAME_REFERENCED_FIELD CANNOT_RENAME_REFERENCED_OBJECT CANNOT_REPARENT_RECORD CANNOT_UPDATE_CONVERTED_LEAD CANT_DISABLE_CORP_CURRENCY CANT_UNSET_CORP_CURRENCY CHILD_SHARE_FAILS_PARENT CIRCULAR_DEPENDENCY CLEAN_SERVICE_ERROR COLLISION_DETECTED COMMUNITY_NOT_ACCESSIBLE CONFLICTING_ENVIRONMENT_HUB_MEMBER CONFLICTING_SSO_USER_MAPPING CUSTOM_APEX_ERROR CUSTOM_CLOB_FIELD_LIMIT_EXCEEDED CUSTOM_ENTITY_OR_FIELD_LIMIT CUSTOM_FIELD_INDEX_LIMIT_EXCEEDED CUSTOM_INDEX_EXISTS CUSTOM_LINK_LIMIT_EXCEEDED CUSTOM_METADATA_LIMIT_EXCEEDED CUSTOM_METADATA_REL_FIELD_MANAGEABILITY CUSTOM_SETTINGS_LIMIT_EXCEEDED CUSTOM_TAB_LIMIT_EXCEEDED DATACLOUDADDRESS_NO_RECORDS_FOUND DATACLOUDADDRESS_PROCESSING_ERROR DATACLOUDADDRESS_SERVER_ERROR DELETE_FAILED DELETE_OPERATION_TOO_LARGE DELETE_REQUIRED_ON_CASCADE DEPENDENCY_EXISTS DUPLICATES_DETECTED DUPLICATE_CASE_SOLUTION DUPLICATE_COMM_NICKNAME DUPLICATE_CUSTOM_ENTITY_DEFINITION DUPLICATE_CUSTOM_TAB_MOTIF DUPLICATE_DEVELOPER_NAME DUPLICATE_EXTERNAL_ID DUPLICATE_MASTER_LABEL DUPLICATE_SENDER_DISPLAY_NAME DUPLICATE_USERNAME DUPLICATE_VALUE EMAIL_ADDRESS_BOUNCED EMAIL_EXTERNAL_TRANSPORT_CONNECTION_ERROR EMAIL_EXTERNAL_TRANSPORT_PERMISSION_ERROR EMAIL_EXTERNAL_TRANSPORT_TOKEN_ERROR EMAIL_EXTERNAL_TRANSPORT_TOO_MANY_REQUESTS_ERROR EMAIL_EXTERNAL_TRANSPORT_UNKNOWN_ERROR EMAIL_NOT_PROCESSED_DUE_TO_PRIOR_ERROR EMAIL_OPTED_OUT EMAIL_TEMPLATE_FORMULA_ERROR EMAIL_TEMPLATE_MERGEFIELD_ACCESS_ERROR EMAIL_TEMPLATE_MERGEFIELD_ERROR EMAIL_TEMPLATE_MERGEFIELD_VALUE_ERROR EMAIL_TEMPLATE_PROCESSING_ERROR EMPTY_SCONTROL_FILE_NAME ENTITY_FAILED_IFLASTMODIFIED_ON_UPDATE ENTITY_IS_ARCHIVED ENTITY_IS_DELETED ENTITY_IS_LOCKED ENTITY_SAVE_ERROR ENTITY_SAVE_VALIDATION_ERROR ENVIRONMENT_HUB_MEMBERSHIP_CONFLICT ENVIRONMENT_HUB_MEMBERSHIP_ERROR_JOINING_HUB ENVIRONMENT_HUB_MEMBERSHIP_USER_ALREADY_IN_HUB ENVIRONMENT_HUB_MEMBERSHIP_USER_NOT_ORG_ADMIN ERROR_IN_MAILER EXCHANGE_WEB_SERVICES_URL_INVALID FAILED_ACTIVATION FIELD_CUSTOM_VALIDATION_EXCEPTION FIELD_FILTER_VALIDATION_EXCEPTION FIELD_INTEGRITY_EXCEPTION FIELD_KEYWORD_LIST_MATCH_LIMIT FIELD_MAPPING_ERROR FIELD_MODERATION_RULE_BLOCK FIELD_NOT_UPDATABLE FILE_EXTENSION_NOT_ALLOWED FILE_SIZE_LIMIT_EXCEEDED FILTERED_LOOKUP_LIMIT_EXCEEDED FIND_DUPLICATES_ERROR FUNCTIONALITY_NOT_ENABLED HAS_PUBLIC_REFERENCES HTML_FILE_UPLOAD_NOT_ALLOWED IMAGE_TOO_LARGE INACTIVE_OWNER_OR_USER INACTIVE_RULE_ERROR INSERT_UPDATE_DELETE_NOT_ALLOWED_DURING_MAINTENANCE INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY INSUFFICIENT_ACCESS_OR_READONLY INSUFFICIENT_ACCESS_TO_INSIGHTSEXTERNALDATA INSUFFICIENT_CREDITS INTERNAL_ERROR INVALID_ACCESS_LEVEL INVALID_ACCESS_TOKEN INVALID_ARGUMENT_TYPE INVALID_ASSIGNEE_TYPE INVALID_ASSIGNMENT_RULE INVALID_BATCH_OPERATION INVALID_CONTENT_TYPE INVALID_CREDIT_CARD_INFO INVALID_CROSS_REFERENCE_KEY INVALID_CROSS_REFERENCE_TYPE_FOR_FIELD INVALID_CURRENCY_CONV_RATE INVALID_CURRENCY_CORP_RATE INVALID_CURRENCY_ISO INVALID_DATA_CATEGORY_GROUP_REFERENCE INVALID_DATA_URI INVALID_EMAIL_ADDRESS INVALID_EMPTY_KEY_OWNER INVALID_ENTITY_FOR_MATCH_ENGINE_ERROR INVALID_ENTITY_FOR_MATCH_OPERATION_ERROR INVALID_ENTITY_FOR_UPSERT INVALID_ENVIRONMENT_HUB_MEMBER INVALID_EVENT_DELIVERY INVALID_EVENT_SUBSCRIPTION INVALID_FIELD INVALID_FIELD_FOR_INSERT_UPDATE INVALID_FIELD_WHEN_USING_TEMPLATE INVALID_FILTER_ACTION INVALID_GOOGLE_DOCS_URL INVALID_ID_FIELD INVALID_INET_ADDRESS INVALID_INPUT INVALID_LINEITEM_CLONE_STATE INVALID_MARKUP INVALID_MASTER_OR_TRANSLATED_SOLUTION INVALID_MESSAGE_ID_REFERENCE INVALID_NAMESPACE_PREFIX INVALID_OAUTH_URL INVALID_OPERATION INVALID_OPERATOR INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST INVALID_OWNER INVALID_PACKAGE_LICENSE INVALID_PACKAGE_VERSION INVALID_PARTNER_NETWORK_STATUS INVALID_PERSON_ACCOUNT_OPERATION INVALID_PROVIDER_TYPE INVALID_QUERY_LOCATOR INVALID_READ_ONLY_USER_DML INVALID_REFRESH_TOKEN INVALID_RUNTIME_VALUE INVALID_SAVE_AS_ACTIVITY_FLAG INVALID_SESSION_ID INVALID_SETUP_OWNER INVALID_SIGNUP_COUNTRY INVALID_SIGNUP_OPTION INVALID_SITE_DELETE_EXCEPTION INVALID_SITE_FILE_IMPORTED_EXCEPTION INVALID_SITE_FILE_TYPE_EXCEPTION INVALID_STATUS INVALID_SUBDOMAIN INVALID_TYPE INVALID_TYPE_FOR_OPERATION INVALID_TYPE_ON_FIELD_IN_RECORD INVALID_USERID IP_RANGE_LIMIT_EXCEEDED JIGSAW_IMPORT_LIMIT_EXCEEDED LICENSE_LIMIT_EXCEEDED LIGHT_PORTAL_USER_EXCEPTION LIMIT_EXCEEDED MALFORMED_ID MANAGER_NOT_DEFINED MASSMAIL_RETRY_LIMIT_EXCEEDED MASS_MAIL_LIMIT_EXCEEDED MATCH_DEFINITION_ERROR MATCH_OPERATION_ERROR MATCH_OPERATION_INVALID_ENGINE_ERROR MATCH_OPERATION_INVALID_RULE_ERROR MATCH_OPERATION_MISSING_ENGINE_ERROR MATCH_OPERATION_MISSING_OBJECT_TYPE_ERROR MATCH_OPERATION_MISSING_OPTIONS_ERROR MATCH_OPERATION_MISSING_RULE_ERROR MATCH_OPERATION_UNKNOWN_RULE_ERROR MATCH_OPERATION_UNSUPPORTED_VERSION_ERROR MATCH_PRECONDITION_FAILED MATCH_RUNTIME_ERROR MATCH_SERVICE_ERROR MATCH_SERVICE_TIMED_OUT MATCH_SERVICE_UNAVAILABLE_ERROR MAXIMUM_CCEMAILS_EXCEEDED MAXIMUM_DASHBOARD_COMPONENTS_EXCEEDED MAXIMUM_HIERARCHY_CHILDREN_REACHED MAXIMUM_HIERARCHY_LEVELS_REACHED MAXIMUM_HIERARCHY_TREE_SIZE_REACHED MAXIMUM_SIZE_OF_ATTACHMENT MAXIMUM_SIZE_OF_DOCUMENT MAX_ACTIONS_PER_RULE_EXCEEDED MAX_ACTIVE_RULES_EXCEEDED MAX_APPROVAL_STEPS_EXCEEDED MAX_DEPTH_IN_FLOW_EXECUTION MAX_FORMULAS_PER_RULE_EXCEEDED MAX_RULES_EXCEEDED MAX_RULE_ENTRIES_EXCEEDED MAX_TASK_DESCRIPTION_EXCEEEDED MAX_TM_RULES_EXCEEDED MAX_TM_RULE_ITEMS_EXCEEDED MAX_TRIGGERS_EXCEEDED MERGE_FAILED METADATA_FIELD_UPDATE_ERROR MISSING_ARGUMENT MISSING_RECORD MIXED_DML_OPERATION NONUNIQUE_SHIPPING_ADDRESS NO_ACCESS_TOKEN NO_ACCESS_TOKEN_FROM_REFRESH NO_APPLICABLE_PROCESS NO_ATTACHMENT_PERMISSION NO_AUTH_PROVIDER NO_INACTIVE_DIVISION_MEMBERS NO_MASS_MAIL_PERMISSION NO_PARTNER_PERMISSION NO_REFRESH_TOKEN NO_SUCH_USER_EXISTS NO_TOKEN_ENDPOINT NUMBER_OUTSIDE_VALID_RANGE NUM_HISTORY_FIELDS_BY_SOBJECT_EXCEEDED OPTED_OUT_OF_MASS_MAIL OP_WITH_INVALID_USER_TYPE_EXCEPTION PACKAGE_LICENSE_REQUIRED PACKAGING_API_INSTALL_FAILED PACKAGING_API_UNINSTALL_FAILED PALI_INVALID_ACTION_ID PALI_INVALID_ACTION_NAME PALI_INVALID_ACTION_TYPE PAL_INVALID_ASSISTANT_RECOMMENDATION_TYPE_ID PAL_INVALID_ENTITY_ID PAL_INVALID_FLEXIPAGE_ID PAL_INVALID_LAYOUT_ID PAL_INVALID_PARAMETERS PA_API_EXCEPTION PA_AXIS_FAULT PA_INVALID_ID_EXCEPTION PA_NO_ACCESS_EXCEPTION PA_NO_DATA_FOUND_EXCEPTION PA_URI_SYNTAX_EXCEPTION PA_VISIBLE_ACTIONS_FILTER_ORDERING_EXCEPTION PORTAL_NO_ACCESS PORTAL_USER_ALREADY_EXISTS_FOR_CONTACT PORTAL_USER_CREATION_RESTRICTED_WITH_ENCRYPTION PRIVATE_CONTACT_ON_ASSET PROCESSING_HALTED QA_INVALID_CREATE_FEED_ITEM QA_INVALID_SUCCESS_MESSAGE QUERY_TIMEOUT QUICK_ACTION_LIST_ITEM_NOT_ALLOWED QUICK_ACTION_LIST_NOT_ALLOWED RECORD_IN_USE_BY_WORKFLOW REL_FIELD_BAD_ACCESSIBILITY REPUTATION_MINIMUM_NUMBER_NOT_REACHED REQUEST_RUNNING_TOO_LONG REQUIRED_FEATURE_MISSING REQUIRED_FIELD_MISSING RETRIEVE_EXCHANGE_ATTACHMENT_FAILED RETRIEVE_EXCHANGE_EMAIL_FAILED RETRIEVE_EXCHANGE_EVENT_FAILED RETRIEVE_GOOGLE_EMAIL_FAILED RETRIEVE_GOOGLE_EVENT_FAILED SALESFORCE_INBOX_TRANSPORT_CONNECTION_ERROR SALESFORCE_INBOX_TRANSPORT_TOKEN_ERROR SALESFORCE_INBOX_TRANSPORT_UNKNOWN_ERROR SELF_REFERENCE_FROM_FLOW SELF_REFERENCE_FROM_TRIGGER SHARE_NEEDED_FOR_CHILD_OWNER SINGLE_EMAIL_LIMIT_EXCEEDED SOCIAL_ACCOUNT_NOT_FOUND SOCIAL_ACTION_INVALID SOCIAL_POST_INVALID SOCIAL_POST_NOT_FOUND STANDARD_PRICE_NOT_DEFINED STORAGE_LIMIT_EXCEEDED STRING_TOO_LONG SUBDOMAIN_IN_USE TABSET_LIMIT_EXCEEDED TEMPLATE_NOT_ACTIVE TEMPLATE_NOT_FOUND TERMS_OF_SERVICE_UNREAD TERRITORY_REALIGN_IN_PROGRESS TEXT_DATA_OUTSIDE_SUPPORTED_CHARSET TOO_MANY_APEX_REQUESTS TOO_MANY_ENUM_VALUE TOO_MANY_POSSIBLE_USERS_EXIST TRANSFER_REQUIRES_READ UNABLE_TO_LOCK_ROW UNAVAILABLE_RECORDTYPE_EXCEPTION UNAVAILABLE_REF UNDELETE_FAILED UNKNOWN_EXCEPTION UNKNOWN_TOKEN_ERROR UNSAFE_HTML_CONTENT UNSPECIFIED_EMAIL_ADDRESS UNSUPPORTED_APEX_TRIGGER_OPERATON UNVERIFIED_SENDER_ADDRESS USER_OWNS_PORTAL_ACCOUNT_EXCEPTION USER_WITH_APEX_SHARES_EXCEPTION VF_COMPILE_ERROR WEBLINK_SIZE_LIMIT_EXCEEDED WEBLINK_URL_INVALID WRONG_CONTROLLER_TYPE XCLEAN_UNEXPECTED_ERROR 
2
  • So this was helpful in getting further down the rabbit hole. But how do I get from the Enum value in the StatusCode to the actual string populated on the page? I looked into the getDmlType() method to find an answer, but I think it demonstrated that these are not the correct errors. I created a contact, added a bogus email, tried to do an Insert and checked the message. I got back the correct status code, but the DML message was "Email Address: invalid email address: test" Also, we are getting these messages before we do a DML statement. These are field level Error messages in VF pages. Commented Mar 16, 2017 at 21:31
  • @RobDavis I see what you mean now. I don't think there is a meaningful way to get those errors, as the strings have no master list, we don't have a convenient method for rendering these values. I think the best you can really do is simply document them as you run in to them. There's only like 10 or so that are incredibly common, the remainder you should rarely ever run in to. Commented Mar 16, 2017 at 22:04

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.