4 Replies Latest reply on Jul 8, 2014 11:14 AM by philmodjunk

    Script for validation

    schmity

      Title

      Script for validation

      Post

           Trying to write a validation step into a script to determine if it can continue or exit based on several criteria:

           if

           get(accountname) ≠ OPS::Lead or get(accountprivilegesetname) ≠ "MX Supervisor" or "Admin"

           Show custom dialog

           exit script

           end if

           if it matches anyone of the criteria (account name OR privilege set name) , I would like the script to continue.  Can I do this in one if statement like I have or do I need to write it another way with else or else if's.  Trying to keep it simple.

           thanks!

        • 1. Re: Script for validation
          philmodjunk

               You need:

               get(accountname) ≠ OPS::Lead AND get(accountprivilegesetname) ≠ "MX Supervisor" AND get(accountprivilegesetname) ≠ "Admin"

               Your original expression is always true.

          • 2. Re: Script for validation
            philmodjunk

                 IsEmpty ( FilterValues ( List ( OPS::Lead ; "MX Supervisor" ; "Admin" ) ; Get ( AccountName ) ) )

                 Will also produce the same result.

            • 3. Re: Script for validation
              schmity
                             Option 1 worked...thank you!
                              
                             I'm don't understand why using AND instead of OR worked though.  It seems like with AND, it would be true if all of them didn't match.

                    

              • 4. Re: Script for validation
                philmodjunk

                     Expression 1 And Expression 2

                      Returns True only if Expression 1 AND expression 2 evaluate as true.

                     Expression 1 Or Expression 2

                     Returns true if Expression 1 evaluates as true OR expression 2 evaluates as true.

                     get(accountname) ≠ OPS::Lead or get(accountprivilegesetname) ≠ "MX Supervisor"

                     Will always be a True statement as any value you could possibly get from Get ( AccountName ) will be True for one term or the other.