0

I get this error:

The formula expression is invalid: Syntax error. Missing ')'

Also not positive I have everything else right. What I want this to say is the Affiliation Status picklist should be new and not blank OR changed and not blank, AND it should be an affiliation between two kinds of Record Types AND the Role picklist value should be Teaching Artist.

AND
(     OR
        (
     AND(ISNEW(),NOT(ISBLANK(TEXT[hed__Affiliation__c].hed__Status__c ))),
     AND(ISCHANGED(TEXT[hed__Affiliation__c].hed__Status__c ),
     NOT(ISBLANK(TEXT[hed__Affiliation__c].hed__Status__c  )))
        ),
     ([hed__Affiliation__c].hed__Contact__r.RecordType.DeveloperName = "Teacher"),
     ([hed__Affiliation__c].hed__Account__r.RecordType.DeveloperName = "Program"), 
     (ISPICKVAL[hed__Affiliation__c].hed__Role__c, "Teaching Artist")

))

1 Answer 1

0

When dealing with lots of parenthesis, it really helps to take time to put things onto individual lines and indent (at least once you get past 2 or 3 parenthesis on a line).

Doing that results in something like this...

AND(
    OR(
        AND(
            ISNEW(),
            NOT(ISBLANK(TEXT[hed__Affiliation__c].hed__Status__c))
        ),
        AND(
            ISCHANGED(TEXT[hed__Affiliation__c].hed__Status__c),
            NOT(ISBLANK(TEXT[hed__Affiliation__c].hed__Status__c))
        )
     ),
     ([hed__Affiliation__c].hed__Contact__r.RecordType.DeveloperName = "Teacher"),
     ([hed__Affiliation__c].hed__Account__r.RecordType.DeveloperName = "Program"), 
     (ISPICKVAL[hed__Affiliation__c].hed__Role__c, "Teaching Artist")
)
)

Which helps make it pretty clear where your extra ')' is. Just remove the final ')' and you should be fine (in terms of syntax).

The ISNEW() function refers to the record itself, not an individual field, so that's not what you want to use (unless it has a different effect in process builder). You can probably remove the AND(ISNEW(), NOT(ISBLANK(TEXT[<field>].hed__Status__c))) entirely.

+edit:

I misread the error. While you did indeed have an extra ')', the error is coming from you missing parenthesis for the TEXT function.

Everywhere you have TEXT[hed__Affiliation__c].hed__Status__c, you should replace with TEXT([hed__Affiliation__c].hed__Status__c).

Functions always need parenthesis in formulas.

3
  • Thanks so much for your help. I've tried both things (just removing the final ')' and saving, and also removing the piece you suggested) and both result in the exact same error as before: The formula expression is invalid: Syntax error. Missing ')'
    – sna
    Dec 11, 2020 at 4:23
  • @sna I misread the error. Updated my answer.
    – Derek F
    Dec 11, 2020 at 17:49
  • Thanks, it's been through iterations and that was def one fix! Learned a key bit though that enabled save: add TEXT for ISBLANK, but not for for ISCHANGED. Unclear why, but it works and is going in my notes. For the win: AND( OR( ISNEW(), AND( ISCHANGED([hed__Affiliation__c].hed__Status__c), NOT(ISBLANK(TEXT([hed__Affiliation__c].hed__Status__c))) ) ), ([hed__Affiliation__c].hed__Contact__r.RecordType.DeveloperName = "Teacher"), ([hed__Affiliation__c].hed__Account__r.RecordType.DeveloperName = "Program") )
    – sna
    Dec 11, 2020 at 20:37

You must log in to answer this question.

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