-1

I am also running into the same error The formula expression is invalid: Syntax error. Found ')'

I am trying to create a formula in a flow.

IF ( {!radio_Please_select_a_product} == {!choice_Cornerstone_Support}, "VSS Generic CSSAVES", (IF({!radio_Please_select_a_product} == {!choice_Cornerstone_Subscription_Cloud}, "VSS Generic At_Risk", (IF({!radio_Please_select_a_product} == {!choice_Neo}, "VSS Generic At_Risk", (IF({!radio_Please_select_a_product} == {!choice_SmartFlow}, "VSS Generic At_Risk", (IF({!radio_Please_select_a_product} == {!choice_Other}, "VSS Generic At_Risk", ))))))
4
  • 2
    Hi, For the Last If condition you have written only for true condition but did not defined Else condition . IF(logical_test, value_if_true, value_if_false) is the syntax for If condition May 19 at 10:05
  • Yes, you can never have a , just before a ) May 19 at 10:25
  • Thank you! This makes complete sense! I missed this detail,
    – user115088
    May 19 at 10:50
  • When building a complex formula, it really helps to review it in a developer's text editor like VS Code or Notepad++ since these will highlight parentheses / braces pairs and make it easier to spot mismatches. May 20 at 16:26

1 Answer 1

2

Formulas quickly become a sea of parenthesis. It really helps to indent formulas like you would with code, especially when it comes to issues of mismatched parenthesis.

So instead of

IF ( {!radio_Please_select_a_product} == {!choice_Cornerstone_Support}, "VSS Generic CSSAVES", (IF({!radio_Please_select_a_product} == {!choice_Cornerstone_Subscription_Cloud}, "VSS Generic At_Risk", (IF({!radio_Please_select_a_product} == {!choice_Neo}, "VSS Generic At_Risk", (IF({!radio_Please_select_a_product} == {!choice_SmartFlow}, "VSS Generic At_Risk", (IF({!radio_Please_select_a_product} == {!choice_Other}, "VSS Generic At_Risk", ))))))

Break things onto individual lines, and indent as appropriate

IF( 
    {!radio_Please_select_a_product} == {!choice_Cornerstone_Support}, 
    "VSS Generic CSSAVES", 
    (IF(
        {!radio_Please_select_a_product} == {!choice_Cornerstone_Subscription_Cloud}, 
        "VSS Generic At_Risk", 
        (IF(
            {!radio_Please_select_a_product} == {!choice_Neo}, 
            "VSS Generic At_Risk", 
            (IF(
                {!radio_Please_select_a_product} == {!choice_SmartFlow}, 
                "VSS Generic At_Risk", 
                (IF(
                    {!radio_Please_select_a_product} == {!choice_Other}, 
                    "VSS Generic At_Risk",
                    
                ))
            ))
        ))

Given this, it's very easy to see a few issues:

  • Your final IF() is missing its third parameter (the condition, value if true, and value if false are all always required)
  • Your extra parenthesis around each nested IF() are unnecessary, and are leading you to not have enough closing parenthesis

You could fix this by adding "" or null as your else value for the final IF(), and cleaning up those parenthesis, but when you're checking a single field over and over you should start thinking "can I use CASE() here?"

Using CASE(), if possible, will be less to type and be easier to read and maintain. It'd look like this:

/* First argument is the thing you want to check */
CASE({!radio_Please_select_a_product},
    /* Each argument pair after the first is the target value to match */
    /*   followed by the value to return if the match succeeds */
    {!choice_Cornerstone_Support}, "VSS Generic CSSAVES",
    {!choice_Cornerstone_Subscription_Cloud}, "VSS Generic At_Risk",
    /* ...and so on */
    /* The final argument is the default value (if no no matches */
    /*   succeed */,
    null
)

The above example is untested

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.