0

I have the following formula for a Checkbox in Salesforce and it keeps giving me the following error.

I am trying to have this box check if "Trip A (or B), 2 Weeks, 1 Week or 3 Days is true along with Zone 1, 2...12 on the User Record while if Zone 1..12 is the dropdown field value on the Account. Not sure I can do that...so any help would be greatly appreciated. Thank you!

Error: Syntax error. Found 'Owner.Trip_A_Zone_1__c'

AND(
 OR(
    Owner.Trip_A_1_Week__c,
    Owner.Trip_A_2_Weeks__c,
    Owner.Trip_A_3_Days__c,
    Owner.Trip_B_1_Week__c,
    Owner.Trip_B_2_Weeks__c,
    Owner.Trip_B_3_Days__c
 ),

 OR(
    Owner.Trip_A_Zone_1__c AND(ISPICKVAL(Account.Zone__c , "Zone 1"),
    Owner.Trip_A_Zone_2__c AND(ISPICKVAL(Account.Zone__c , "Zone 2"),
    Owner.Trip_A_Zone_3__c AND(ISPICKVAL(Account.Zone__c , "Zone 3"),
    Owner.Trip_A_Zone_4__c AND(ISPICKVAL(Account.Zone__c , "Zone 4"),
    Owner.Trip_A_Zone_5__c AND(ISPICKVAL(Account.Zone__c , "Zone 5"),
    Owner.Trip_A_Zone_6__c AND(ISPICKVAL(Account.Zone__c , "Zone 6"),
    Owner.Trip_A_Zone_7__c AND(ISPICKVAL(Account.Zone__c , "Zone 7"),
    Owner.Trip_A_Zone_8__c AND(ISPICKVAL(Account.Zone__c , "Zone 8"),
    Owner.Trip_A_Zone_9__c AND(ISPICKVAL(Account.Zone__c , "Zone 9"),
    Owner.Trip_A_Zone_10__c AND(ISPICKVAL(Account.Zone__c , "Zone 10"),
    Owner.Trip_A_Zone_11__c AND(ISPICKVAL(Account.Zone__c , "Zone 11"),
    Owner.Trip_A_Zone_12__c AND(ISPICKVAL(Account.Zone__c , "Zone 12"),
    Owner.Trip_B_Zone_1__c AND(ISPICKVAL(Account.Zone__c , "Zone 1"),
    Owner.Trip_B_Zone_2__c AND(ISPICKVAL(Account.Zone__c , "Zone 2"),
    Owner.Trip_B_Zone_3__c AND(ISPICKVAL(Account.Zone__c , "Zone 3"),
    Owner.Trip_B_Zone_4__c AND(ISPICKVAL(Account.Zone__c , "Zone 4"),
    Owner.Trip_B_Zone_5__c AND(ISPICKVAL(Account.Zone__c , "Zone 5"),
    Owner.Trip_B_Zone_6__c AND(ISPICKVAL(Account.Zone__c , "Zone 6"),
    Owner.Trip_B_Zone_7__c AND(ISPICKVAL(Account.Zone__c , "Zone 7"),
    Owner.Trip_B_Zone_8__c AND(ISPICKVAL(Account.Zone__c , "Zone 8"),
    Owner.Trip_B_Zone_9__c AND(ISPICKVAL(Account.Zone__c , "Zone 9"),
    Owner.Trip_B_Zone_10__c AND(ISPICKVAL(Account.Zone__c , "Zone 10"),
    Owner.Trip_B_Zone_11__c AND(ISPICKVAL(Account.Zone__c , "Zone 11"),
    Owner.Trip_B_Zone_12__c AND(ISPICKVAL(Account.Zone__c , "Zone 12")
  )
)

1 Answer 1

1

You are getting this error because the way you used AND condition is not correct.

The syntax for using AND is

AND(firstCondition, secondCondition) //this is how it should be used

The way you used in your formula is

firstCondition AND secondCondition //this is incorrect

So, your formula should be

AND(
 OR(
    Owner.Trip_A_1_Week__c,
    Owner.Trip_A_2_Weeks__c,
    Owner.Trip_A_3_Days__c,
    Owner.Trip_B_1_Week__c,
    Owner.Trip_B_2_Weeks__c,
    Owner.Trip_B_3_Days__c
 ),
 OR(
    AND(Owner.Trip_A_Zone_1__c, ISPICKVAL(Account.Zone__c , "Zone 1")),
    AND(Owner.Trip_A_Zone_2__c, ISPICKVAL(Account.Zone__c , "Zone 2")),
    AND(Owner.Trip_A_Zone_3__c, ISPICKVAL(Account.Zone__c , "Zone 3")),
    AND(Owner.Trip_A_Zone_4__c, ISPICKVAL(Account.Zone__c , "Zone 4")),
    AND(Owner.Trip_A_Zone_5__c, ISPICKVAL(Account.Zone__c , "Zone 5")),
    AND(Owner.Trip_A_Zone_6__c, ISPICKVAL(Account.Zone__c , "Zone 6")),
    AND(Owner.Trip_A_Zone_7__c, ISPICKVAL(Account.Zone__c , "Zone 7")),
    AND(Owner.Trip_A_Zone_8__c, ISPICKVAL(Account.Zone__c , "Zone 8")),
    AND(Owner.Trip_A_Zone_9__c, ISPICKVAL(Account.Zone__c , "Zone 9")),
    AND(Owner.Trip_A_Zone_10__c, ISPICKVAL(Account.Zone__c , "Zone 10")),
    AND(Owner.Trip_A_Zone_11__c, ISPICKVAL(Account.Zone__c , "Zone 11")),
    AND(Owner.Trip_A_Zone_12__c, ISPICKVAL(Account.Zone__c , "Zone 12")),
    AND(Owner.Trip_B_Zone_1__c, ISPICKVAL(Account.Zone__c , "Zone 1")),
    AND(Owner.Trip_B_Zone_2__c, ISPICKVAL(Account.Zone__c , "Zone 2")),
    AND(Owner.Trip_B_Zone_3__c, ISPICKVAL(Account.Zone__c , "Zone 3")),
    AND(Owner.Trip_B_Zone_4__c, ISPICKVAL(Account.Zone__c , "Zone 4")),
    AND(Owner.Trip_B_Zone_5__c, ISPICKVAL(Account.Zone__c , "Zone 5")),
    AND(Owner.Trip_B_Zone_6__c, ISPICKVAL(Account.Zone__c , "Zone 6")),
    AND(Owner.Trip_B_Zone_7__c, ISPICKVAL(Account.Zone__c , "Zone 7")),
    AND(Owner.Trip_B_Zone_8__c, ISPICKVAL(Account.Zone__c , "Zone 8")),
    AND(Owner.Trip_B_Zone_9__c, ISPICKVAL(Account.Zone__c , "Zone 9")),
    AND(Owner.Trip_B_Zone_10__c, ISPICKVAL(Account.Zone__c , "Zone 10")),
    AND(Owner.Trip_B_Zone_11__c, ISPICKVAL(Account.Zone__c , "Zone 11")),
    AND(Owner.Trip_B_Zone_12__c, ISPICKVAL(Account.Zone__c , "Zone 12"))
  )
)

So your formula would return true if any of the User's Trip (A/B)(1 Week/2 Weeks/3 Days) is true and any of User's Trip (A/B)(1/2/../12) is true and Account's zone is Zone (1/2/3../12) else it will return false.

2
  • Thank you so much!
    – JLSI
    Commented Mar 12, 2019 at 21:54
  • Hi @JLSI, did that formula work ? If yes,then please consider accepting it by clicking the check-mark. This indicates to the wider community that you've found a solution and gives some reputation to both the answerer and yourself. There is no obligation to do this. Commented Mar 14, 2019 at 6:04

You must log in to answer this question.

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