0

I need to create a validation rule on standard object "Contract" that will fire on standard Activate Button, the formula will:

If(status != 'Activated' && DateOne == Null, && DateTwo == null && Recordtype == 'Two'){
   Mesage("please fillout the dates and make sure Record Type = One");
}
If(status != 'Activated' && DateOne != Null, && DateTwo != null && Recordtype == 'Two'){
   msg("please select record type one");
}

closed as off-topic by Adrian Larson, Vigneshwaran G, Eric, Brian Mansfield, Mohith Shrivastava Nov 10 '16 at 1:06

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on problems in code you've written must describe the specific problem and include valid code to reproduce it. For help writing short, self-contained syntactically-valid examples, see: SSCCE.org" – Adrian Larson, Vigneshwaran G, Eric, Brian Mansfield, Mohith Shrivastava
If this question can be reworded to fit the rules in the help center, please edit the question.

0

You need two separate Validation Rules. You specify the Error Message separately from the Error Condition Formula.

One of your criteria seems wrong, because when exactly one of the date fields is null, neither rule applies. Based on the error messages in your post, I assume you meant if either date is null and the Status is not yet 'Activated', then the RecordType must still be 'One'. Currently you only do the validation if both dates are null.

You should also explicitly ensure the RecordType is still 'One' if that is your intention. Right now there may only be two possible values, but that can change.

Inactive Either Null Rule Criteria

AND(
    Status != 'Activated',
    RecordType.Name != 'One',
    OR(Date1__c = null, Date2__c = null)
)

Inactive Neither Null Rule Criteria

AND(
    Status != 'Activated',
    RecordType.Name != 'One',
    Date1__c != null,
    Date2__c != null
)
  • the 1st one works just fine. Thanks. – Templar Nov 9 '16 at 20:47

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