function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
N. WeidmanN. Weidman 

Converting Process to a Formula field with a syntax error

I am working with cleaning up a lot of legacy things in an org I recently came into.  In one case, there is a process that I think will work just as well, if not better, as a regular formula field.  However, copying over the formula in it, I am getting a Syntax error. Missing '='

Here is the formula:

IF(
    OR(
        ISPICKVAL([Account].CS_Relationship_Health_Score__c, "Red"),
        ISPICKVAL([Account].CS_Adoption_Health_Score__c , "Red"),
        ISPICKVAL([Account].CS_Product_Health_Score__c , "Red"),
        ISPICKVAL([Account].CS_Services_Health_Score__c , "Red"),
        ISPICKVAL([Account].CS_Support_Health_Score__c , "Red") 
    ) ,
"Red",
    IF(
        OR(
            ISPICKVAL([Account].CS_Relationship_Health_Score__c, "Yellow"),
            ISPICKVAL([Account].CS_Adoption_Health_Score__c , "Yellow"),
            ISPICKVAL([Account].CS_Product_Health_Score__c , "Yellow"),
            ISPICKVAL([Account].CS_Services_Health_Score__c , "Yellow"),
            ISPICKVAL([Account].CS_Support_Health_Score__c , "Yellow") 
            ) ,
    "Yellow",
    "Green"
    )
)

Can anyone help with clearing up the error?
Best Answer chosen by N. Weidman
Maharajan CMaharajan C
Hi Weidman,

[Account].CS_Relationship_Health_Score__c   ==>  No need of [Account] in formula field.

In formula field you have to change the formula like below:
 
IF(
    OR(
        ISPICKVAL(CS_Relationship_Health_Score__c, "Red"),
        ISPICKVAL(CS_Adoption_Health_Score__c , "Red"),
        ISPICKVAL(CS_Product_Health_Score__c , "Red"),
        ISPICKVAL(CS_Services_Health_Score__c , "Red"),
        ISPICKVAL(CS_Support_Health_Score__c , "Red") 
    ) ,
"Red",
    IF(
        OR(
            ISPICKVAL(CS_Relationship_Health_Score__c, "Yellow"),
            ISPICKVAL(CS_Adoption_Health_Score__c , "Yellow"),
            ISPICKVAL(CS_Product_Health_Score__c , "Yellow"),
            ISPICKVAL(CS_Services_Health_Score__c , "Yellow"),
            ISPICKVAL(CS_Support_Health_Score__c , "Yellow") 
            ) ,
    "Yellow",
    "Green"
    )
)


Thanks,
Maharajan.C

All Answers

VinayVinay (Salesforce Developers) 
Hi Wiedman,

Can you let us know what you are trying to acheive using above formula along with object details ?

Thanks,
Maharajan CMaharajan C
Hi Weidman,

[Account].CS_Relationship_Health_Score__c   ==>  No need of [Account] in formula field.

In formula field you have to change the formula like below:
 
IF(
    OR(
        ISPICKVAL(CS_Relationship_Health_Score__c, "Red"),
        ISPICKVAL(CS_Adoption_Health_Score__c , "Red"),
        ISPICKVAL(CS_Product_Health_Score__c , "Red"),
        ISPICKVAL(CS_Services_Health_Score__c , "Red"),
        ISPICKVAL(CS_Support_Health_Score__c , "Red") 
    ) ,
"Red",
    IF(
        OR(
            ISPICKVAL(CS_Relationship_Health_Score__c, "Yellow"),
            ISPICKVAL(CS_Adoption_Health_Score__c , "Yellow"),
            ISPICKVAL(CS_Product_Health_Score__c , "Yellow"),
            ISPICKVAL(CS_Services_Health_Score__c , "Yellow"),
            ISPICKVAL(CS_Support_Health_Score__c , "Yellow") 
            ) ,
    "Yellow",
    "Green"
    )
)


Thanks,
Maharajan.C
This was selected as the best answer
Maharajan CMaharajan C
Remove [Account] in formula.... This will solve your issue...
N. WeidmanN. Weidman
That did it, thanks!
N. WeidmanN. Weidman

Well, I couldn't leave well enough alone...

The picklists that the above was referencing were themselves updated by a DIFFERENT process.  Using your formula as an example, I was able to update all of them to formula fields instead and eliminate that process.  However, that means the above no longer references picklist values, but rather text in a formula field.  I've tried a couple of different things, but I still keep getting syntax errors.  This is what I started with:

IF(
    OR(
        TEXT(CS_Relationship_Health_Score_Formula__c, "Red"),
        TEXT(CS_Adoption_Health_Score_Formula__c , "Red"),
        TEXT(CS_Product_Health_Score_Formula__c , "Red"),
        TEXT(CS_Services_Health_Score_Formula__c , "Red"),
        TEXT(CS_Support_Health_Score_Formula__c , "Red") 
    ) ,
"Red",
    IF(
        OR(
            TEXT(CS_Relationship_Health_Score_Formula__c, "Yellow"),
            TEXT(CS_Adoption_Health_Score_Formula__c , "Yellow"),
            TEXT(CS_Product_Health_Score_Formula__c , "Yellow"),
            TEXT(CS_Services_Health_Score_Formula__c , "Yellow"),
            TEXT(CS_Support_Health_Score_Formula__c , "Yellow") 
            ) ,
    "Yellow",
    "Green"
    )
)

I also attempted:

IF(
    OR(
        VALUE(CS_Relationship_Health_Score_Formula__c) = "Red"),
        VALUE(CS_Adoption_Health_Score_Formula__c) = "Red"),
        VALUE(CS_Product_Health_Score_Formula__c) = "Red"),
        VALUE(CS_Services_Health_Score_Formula__c) = "Red"),
        VALUE(CS_Support_Health_Score_Formula__c) = "Red") 
    ) ,
"Red",
    IF(
        OR(
            VALUE(CS_Relationship_Health_Score_Formula__c) = "Yellow"),
            VALUE(CS_Adoption_Health_Score_Formula__c) = "Yellow"),
            VALUE(CS_Product_Health_Score_Formula__c) = "Yellow"),
            VALUE(CS_Services_Health_Score_Formula__c) = "Yellow"),
            VALUE(CS_Support_Health_Score_Formula__c) = "Yellow") 
            ) ,
    "Yellow",
    "Green"
    )
)
Could I trouble you again for clarification?
Thomas Connors 15Thomas Connors 15
I faced similar kind of issue last time, I am still searching for some proper solution Same issue still no fix to this.



prepaidcardstatus (https://www.prepaidcardstatus.org/)