How to perform field update before a Validation Rule? (without code)

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
1
down vote

favorite












I have a requirement in which I have to check a Cases Owner before I can insert a task. It should only allow task creation on Cases with Owners which are not queues.



At first, we tried accessing the case Owner field on a validation rule. That doesn't seem to be possible due to they way the task-case relationshop works.



Then, we tried with a field update (Process Builder, workflow rule) to update a "Case Owner Is Queue?" field on the task as it is created.
With that field updated, creating the validation rule would be simple.



The obvious problem here is that validation rules run before any process or Workflow rule.



Is there a solution to this problem? I want to avoid code unless there is no other way around it.










share|improve this question



























    up vote
    1
    down vote

    favorite












    I have a requirement in which I have to check a Cases Owner before I can insert a task. It should only allow task creation on Cases with Owners which are not queues.



    At first, we tried accessing the case Owner field on a validation rule. That doesn't seem to be possible due to they way the task-case relationshop works.



    Then, we tried with a field update (Process Builder, workflow rule) to update a "Case Owner Is Queue?" field on the task as it is created.
    With that field updated, creating the validation rule would be simple.



    The obvious problem here is that validation rules run before any process or Workflow rule.



    Is there a solution to this problem? I want to avoid code unless there is no other way around it.










    share|improve this question























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I have a requirement in which I have to check a Cases Owner before I can insert a task. It should only allow task creation on Cases with Owners which are not queues.



      At first, we tried accessing the case Owner field on a validation rule. That doesn't seem to be possible due to they way the task-case relationshop works.



      Then, we tried with a field update (Process Builder, workflow rule) to update a "Case Owner Is Queue?" field on the task as it is created.
      With that field updated, creating the validation rule would be simple.



      The obvious problem here is that validation rules run before any process or Workflow rule.



      Is there a solution to this problem? I want to avoid code unless there is no other way around it.










      share|improve this question













      I have a requirement in which I have to check a Cases Owner before I can insert a task. It should only allow task creation on Cases with Owners which are not queues.



      At first, we tried accessing the case Owner field on a validation rule. That doesn't seem to be possible due to they way the task-case relationshop works.



      Then, we tried with a field update (Process Builder, workflow rule) to update a "Case Owner Is Queue?" field on the task as it is created.
      With that field updated, creating the validation rule would be simple.



      The obvious problem here is that validation rules run before any process or Workflow rule.



      Is there a solution to this problem? I want to avoid code unless there is no other way around it.







      workflow process-builder case validation-rule tasks






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 1 hour ago









      Henrique

      152




      152




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          3
          down vote













          Combining a declarative field update with a validation rule is a creative idea. Some people would go right for code!



          You're right about it being impossible though, since custom validation rules run before workflow rules or process builder flows could update the record. You will have to use a trigger for this.



          You can run the case owner check, and then use the addError method to stop the record(s) from being saved to the database.



          For reference, this is the order of execution for creating a record:



          1. Runs system validation rules and validation rules for multiline
            objects (opportunity line-items, quote line-items, ...)

          2. Executes all before triggers Custom Validation rules

          3. Executes all after triggers

          4. Executes assignment rules

          5. Executes auto-response rules

          6. Executes workflow rules

          and so on.



          Complete Order of Execution reference here.



          Standard validation rules are run again after a record is updated by a workflow or process builder, but custom validation rules aren't, which leaves you stuck with a trigger.






          share|improve this answer










          New contributor




          Dean M. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.
























            up vote
            0
            down vote













            Validation rules run again after Process Builders. However the error messages you get when a PB violates a validation rule might be uglier.






            share|improve this answer




















              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%2f235764%2fhow-to-perform-field-update-before-a-validation-rule-without-code%23new-answer', 'question_page');

              );

              Post as a guest






























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              3
              down vote













              Combining a declarative field update with a validation rule is a creative idea. Some people would go right for code!



              You're right about it being impossible though, since custom validation rules run before workflow rules or process builder flows could update the record. You will have to use a trigger for this.



              You can run the case owner check, and then use the addError method to stop the record(s) from being saved to the database.



              For reference, this is the order of execution for creating a record:



              1. Runs system validation rules and validation rules for multiline
                objects (opportunity line-items, quote line-items, ...)

              2. Executes all before triggers Custom Validation rules

              3. Executes all after triggers

              4. Executes assignment rules

              5. Executes auto-response rules

              6. Executes workflow rules

              and so on.



              Complete Order of Execution reference here.



              Standard validation rules are run again after a record is updated by a workflow or process builder, but custom validation rules aren't, which leaves you stuck with a trigger.






              share|improve this answer










              New contributor




              Dean M. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.





















                up vote
                3
                down vote













                Combining a declarative field update with a validation rule is a creative idea. Some people would go right for code!



                You're right about it being impossible though, since custom validation rules run before workflow rules or process builder flows could update the record. You will have to use a trigger for this.



                You can run the case owner check, and then use the addError method to stop the record(s) from being saved to the database.



                For reference, this is the order of execution for creating a record:



                1. Runs system validation rules and validation rules for multiline
                  objects (opportunity line-items, quote line-items, ...)

                2. Executes all before triggers Custom Validation rules

                3. Executes all after triggers

                4. Executes assignment rules

                5. Executes auto-response rules

                6. Executes workflow rules

                and so on.



                Complete Order of Execution reference here.



                Standard validation rules are run again after a record is updated by a workflow or process builder, but custom validation rules aren't, which leaves you stuck with a trigger.






                share|improve this answer










                New contributor




                Dean M. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.



















                  up vote
                  3
                  down vote










                  up vote
                  3
                  down vote









                  Combining a declarative field update with a validation rule is a creative idea. Some people would go right for code!



                  You're right about it being impossible though, since custom validation rules run before workflow rules or process builder flows could update the record. You will have to use a trigger for this.



                  You can run the case owner check, and then use the addError method to stop the record(s) from being saved to the database.



                  For reference, this is the order of execution for creating a record:



                  1. Runs system validation rules and validation rules for multiline
                    objects (opportunity line-items, quote line-items, ...)

                  2. Executes all before triggers Custom Validation rules

                  3. Executes all after triggers

                  4. Executes assignment rules

                  5. Executes auto-response rules

                  6. Executes workflow rules

                  and so on.



                  Complete Order of Execution reference here.



                  Standard validation rules are run again after a record is updated by a workflow or process builder, but custom validation rules aren't, which leaves you stuck with a trigger.






                  share|improve this answer










                  New contributor




                  Dean M. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  Combining a declarative field update with a validation rule is a creative idea. Some people would go right for code!



                  You're right about it being impossible though, since custom validation rules run before workflow rules or process builder flows could update the record. You will have to use a trigger for this.



                  You can run the case owner check, and then use the addError method to stop the record(s) from being saved to the database.



                  For reference, this is the order of execution for creating a record:



                  1. Runs system validation rules and validation rules for multiline
                    objects (opportunity line-items, quote line-items, ...)

                  2. Executes all before triggers Custom Validation rules

                  3. Executes all after triggers

                  4. Executes assignment rules

                  5. Executes auto-response rules

                  6. Executes workflow rules

                  and so on.



                  Complete Order of Execution reference here.



                  Standard validation rules are run again after a record is updated by a workflow or process builder, but custom validation rules aren't, which leaves you stuck with a trigger.







                  share|improve this answer










                  New contributor




                  Dean M. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  share|improve this answer



                  share|improve this answer








                  edited 1 hour ago





















                  New contributor




                  Dean M. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  answered 1 hour ago









                  Dean M.

                  413




                  413




                  New contributor




                  Dean M. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.





                  New contributor





                  Dean M. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






                  Dean M. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






















                      up vote
                      0
                      down vote













                      Validation rules run again after Process Builders. However the error messages you get when a PB violates a validation rule might be uglier.






                      share|improve this answer
























                        up vote
                        0
                        down vote













                        Validation rules run again after Process Builders. However the error messages you get when a PB violates a validation rule might be uglier.






                        share|improve this answer






















                          up vote
                          0
                          down vote










                          up vote
                          0
                          down vote









                          Validation rules run again after Process Builders. However the error messages you get when a PB violates a validation rule might be uglier.






                          share|improve this answer












                          Validation rules run again after Process Builders. However the error messages you get when a PB violates a validation rule might be uglier.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 1 hour ago









                          Charles T

                          5,5701618




                          5,5701618



























                               

                              draft saved


                              draft discarded















































                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f235764%2fhow-to-perform-field-update-before-a-validation-rule-without-code%23new-answer', 'question_page');

                              );

                              Post as a guest













































































                              Comments

                              Popular posts from this blog

                              What does second last employer means? [closed]

                              List of Gilmore Girls characters

                              Confectionery