+ Start a Discussion
Christi Kane gobucksChristi Kane gobucks 

2 If statements with Case flow formula

I am in visual flow, and creating a formula, based on sales channel criteria, to put in the appropriate email (currently in sandbox they are all my emails). It keeps telling me the syntax is invalid. Help! TIA.

IF({!UserSalesChannel}<>"Local",
CASE({!UserSalesChannel},
          “Corporate”, "ckane606@comcast.net",
          “3PL”, "christi.kane16@gmail.com",
          “HNRY”, "christimkane@gmail.com",
          “YRCW”, "alyssa112277@gmail.com",
           "christi.kane@yrcw.com"),
IF({!UserSalesChannel}="Local",
CASE({!UserDivision},
“1”, "ckane606@comcast.net",
“2”, "christi.kane16@gmail.com",
“3”, "christimkane@gmail.com",
“4”, "alyssa112277@gmail.com",
"Christi.kane@yrcw.com"), “Christi.kane@yrcw.com))
 
ShirishaShirisha (Salesforce Developers) 
Hi Chirsti,

Greetings!

Have you tried with the CONTAINS function to achieve this as suggested in the below thread.

https://trailblazers.salesforce.com/answers?id=9063A000000DepPQAS

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
Christi Kane gobucksChristi Kane gobucks
Shirisha,
I tried the below and it still says INVALID SYNTAX . . . .

IF(CONTAINS({!UserSalesChannel}, “Corporate”), “ckane606@comcast.net”,
IF(CONTAINS({!UserSalesChannel}, “3PL”), “Christi.kane16@gmail.com”,
IF(CONTAINS({!UserSalesChannel}, “HNRY”),”christimkane@gmail.com”,
IF(CONTAINS({!UserSalesChannel}, “YRCW”), “alyssa112277@gmail.com”,
IF(CONTAINS({!UserSalesChannel}, “Local”) && CONTAINS({!UserDivision}, “1”)), “ckane606@comcast.net”,
IF(CONTAINS({!UserSalesChannel}, “Local”) && CONTAINS({!UserDivision}, “2”)), “Christi.kane16@gmail.com”,
IF(CONTAINS({!UserSalesChannel}, “Local”) && CONTAINS({!UserDivision}, “3”)), “christimkane@gmail.com”,
IF(CONTAINS({!UserSalesChannel}, “Local”) && CONTAINS({!UserDivision}, “4”)), “alyssa112277@gmail.com”, NULL))))))))
 
Christi Kane gobucksChristi Kane gobucks
I got it working! By copying it OUT of the flow to share, and not being able to save, then copying it back in, I had 'curly' quotation marks, so I retyped it all with SINGLE quotation marks (and I used Contains - thank you Shirisha) - to have the following:

IF(
CONTAINS({!UserSalesChannel}, 'Corporate'), 'ckane606@comcast.net',
IF(
CONTAINS({!UserSalesChannel}, '3PL'), 'christi.kane16@gmail.com',
IF(
CONTAINS({!UserSalesChannel}, 'HNRY'), 'christimkane@gmail.com',
IF(
CONTAINS({!UserSalesChannel}, 'YRCW'), 'alyssa112277@gmail.com',
IF(
CONTAINS({!UserSalesChannel}, 'Local') && CONTAINS({!UserDivision}, '1'), 'ckane606@comcast.net',
IF(
CONTAINS({!UserSalesChannel}, 'Local') && CONTAINS({!UserDivision}, '2'), 'christi.kane16@gmail.com',
IF(
CONTAINS({!UserSalesChannel}, 'Local') && CONTAINS({!UserDivision}, '3'), 'christimkane@gmail.com',
IF(
CONTAINS({!UserSalesChannel}, 'Local') && CONTAINS({!UserDivision}, '4'), 'alyssa112277@gmail.com',

 NULL))))))))