My colleague asked me today an interesting question I never thought of before. Is that possible to write a validation rule that would allow to update only two fields of 800 on a custom object?

I know that this question might sound strange, as I would never try to do something like this myself, I would use page layout to restrict users from editing fields or FLS or in the worst case I would write an apex trigger to implement this. But this question is about configuration approach.

Also the reason why he doesn't want to use page layout is that he doesn't want to use record types and due to his requirements he had to make 798 fields of 800 readonly if value of some custom status field on record is On Hold.

I was thinking of using "ISCHANGED" advanced formula function but that would not distinguish if only two permitted fields were changed or more.

3 Answers 3


No. You can't have enough validation rules that could cover this, nor could you have one (or even a few) rules that would compile within the limits of the system. Something this complicated would be best served by a trigger that could check all 798 fields for changes.


You can assign the Account to a specific recordType lets say CustomRecX and assign to page layout and make all the fields as readonly except that two fields.

In the validation rule, use this logic to throw the error when user is trying to save without changing any of the field values:

(RecordType.DeveloperName = 'CustomRecX') 
  && (NOT(ISCHANGED(Field1__c)) 
  || NOT(ISCHANGED(Field2__c)))

Otherwise, you need to handle with triggers.


I'm not sure if this wouldn't be to long for a validation rule, but I think you could just count the number of changed fields?

3 > ( IF(ISCHANGED(field1__c), 1, 0) + 
      IF(ISCHANGED(field2__c), 1, 0) + 
      IF(ISCHANGED(field3__c), 1, 0) ...  etc )
  • 1
    I think it would fail the compiled formula size
    – Patlatus
    Aug 14, 2018 at 10:25
  • @Patlatus Yeah I guess you're right.
    – Kasper
    Aug 14, 2018 at 11:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .