Is that possible to write a validation rule that would allow to update only two fields of 800 on a custom object record?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
2
down vote

favorite












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.







share|improve this question


























    up vote
    2
    down vote

    favorite












    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.







    share|improve this question






















      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      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.







      share|improve this question












      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.









      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 14 at 9:28









      Patlatus

      4,85411848




      4,85411848




















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          5
          down vote













          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.






          share|improve this answer



























            up vote
            1
            down vote













            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.






            share|improve this answer





























              up vote
              0
              down vote













              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 )





              share|improve this answer
















              • 1




                I think it would fail the compiled formula size
                – Patlatus
                Aug 14 at 10:25










              • @Patlatus Yeah I guess you're right.
                – Kasper
                Aug 14 at 11:11










              Your Answer







              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "459"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              convertImagesToLinks: false,
              noModals: false,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













               

              draft saved


              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f228798%2fis-that-possible-to-write-a-validation-rule-that-would-allow-to-update-only-two%23new-answer', 'question_page');

              );

              Post as a guest






























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              5
              down vote













              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.






              share|improve this answer
























                up vote
                5
                down vote













                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.






                share|improve this answer






















                  up vote
                  5
                  down vote










                  up vote
                  5
                  down vote









                  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.






                  share|improve this answer












                  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.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Aug 14 at 10:25









                  sfdcfox

                  225k10170384




                  225k10170384






















                      up vote
                      1
                      down vote













                      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.






                      share|improve this answer


























                        up vote
                        1
                        down vote













                        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.






                        share|improve this answer
























                          up vote
                          1
                          down vote










                          up vote
                          1
                          down vote









                          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.






                          share|improve this answer














                          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.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Aug 14 at 10:48

























                          answered Aug 14 at 10:42









                          Santanu Boral

                          28.4k51847




                          28.4k51847




















                              up vote
                              0
                              down vote













                              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 )





                              share|improve this answer
















                              • 1




                                I think it would fail the compiled formula size
                                – Patlatus
                                Aug 14 at 10:25










                              • @Patlatus Yeah I guess you're right.
                                – Kasper
                                Aug 14 at 11:11














                              up vote
                              0
                              down vote













                              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 )





                              share|improve this answer
















                              • 1




                                I think it would fail the compiled formula size
                                – Patlatus
                                Aug 14 at 10:25










                              • @Patlatus Yeah I guess you're right.
                                – Kasper
                                Aug 14 at 11:11












                              up vote
                              0
                              down vote










                              up vote
                              0
                              down vote









                              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 )





                              share|improve this answer












                              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 )






                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Aug 14 at 9:53









                              Kasper

                              1,009615




                              1,009615







                              • 1




                                I think it would fail the compiled formula size
                                – Patlatus
                                Aug 14 at 10:25










                              • @Patlatus Yeah I guess you're right.
                                – Kasper
                                Aug 14 at 11:11












                              • 1




                                I think it would fail the compiled formula size
                                – Patlatus
                                Aug 14 at 10:25










                              • @Patlatus Yeah I guess you're right.
                                – Kasper
                                Aug 14 at 11:11







                              1




                              1




                              I think it would fail the compiled formula size
                              – Patlatus
                              Aug 14 at 10:25




                              I think it would fail the compiled formula size
                              – Patlatus
                              Aug 14 at 10:25












                              @Patlatus Yeah I guess you're right.
                              – Kasper
                              Aug 14 at 11:11




                              @Patlatus Yeah I guess you're right.
                              – Kasper
                              Aug 14 at 11:11

















                               

                              draft saved


                              draft discarded















































                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f228798%2fis-that-possible-to-write-a-validation-rule-that-would-allow-to-update-only-two%23new-answer', 'question_page');

                              );

                              Post as a guest













































































                              Comments

                              Popular posts from this blog

                              What does second last employer means? [closed]

                              Installing NextGIS Connect into QGIS 3?

                              One-line joke