1

System.DmlException: Update failed. First exception on row 0 with id 003i0000001ZHIvAAO; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, You can not save an existing record without email.

1

You can make your Visualforce tolerant of such custom validations by handling the DmlExceptions that result if you have a controller:

public PageReference save() {
    Savepoint sp = Database.setSavepoint();
    try {
        // Save logic goes here
        return ...;
    } catch (DmlException e) {
        ApexPages.addMessages(e);
    }
    Database.rollback(sp);
    return null;
}

Otherwise the simplest thing to do is to duplicate the fact that the email address is required by using the apex:inputField required attribute:

<apex:inputField value="{!Contact.Email}" required="true"/>

That will (gracefully) block the page submission with an appropriate message before the custom validation rule gets to run.

Make sure you have an apex:pageMessages in the page to display the error messages whichever approach you take.

0

There is custom validation rule on your object which is asking for email field. make sure you are email field exist on your visualforce page and you are passing value in that field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.