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
mluisimluisi 

Incorrect parameter type for function 'AND()'. Expected Boolean, received TEXT

IF(AND(

OR(
    Account.BillingState = "AR",
    Account.BillingState = "GA",
    Account.BillingState = "KS",
    Account.BillingState = "MI",
    Account.BillingState = "WA"),
OR(
    ISPICKVAL(Resident_Water_Responsibility__c, "from the main to the home."),
    ISPICKVAL(Resident_Water_Responsibility__c, "from the main to the shut-off valves of the home's interior supply lines.")),
    "High Claim w/ Water Extension"),
  
IF(AND(
    Account.BillingState = "CA",
OR(
    ISPICKVAL(Resident_Water_Responsibility__c, "from the main to the home."),
    ISPICKVAL(Resident_Water_Responsibility__c, "from the main to the shut-off valves of the home's interior supply lines.")),"California w/ Water Extension")),
    
IF(AND(
OR(
    Account.BillingState <> "CA",
    Account.BillingState <> "AR",
    Account.BillingState <> "GA",
    Account.BillingState <> "KS",
    Account.BillingState <> "MI",
    Account.BillingState <> "WA"),
OR(
    ISPICKVAL(Resident_Water_Responsibility__c, "from the main to the home."),
    ISPICKVAL(Resident_Water_Responsibility__c, "from the main to the shut-off valves of the home's interior supply lines.")),
    "Low Claim w/ Water Extension")),
        
IF(AND(
OR(
    Account.BillingState = "AR",
    Account.BillingState = "GA",
    Account.BillingState = "KS",
    Account.BillingState = "MI",
    Account.BillingState = "WA"),
OR(
    NOT(ISPICKVAL(Resident_Water_Responsibility__c, "from the main to the home.")),
    NOT(ISPICKVAL(Resident_Water_Responsibility__c, "from the main to the shut-off valves of the home's interior supply lines.")),
    "High Claim"))),
  
IF(AND(
    Account.BillingState = CA,
OR(
    NOT(ISPICKVAL(Resident_Water_Responsibility__c, "from the main to the home.")),
    NOT(ISPICKVAL(Resident_Water_Responsibility__c, "from the main to the shut-off valves of the home's interior supply lines.")),"CA Claim"))),
    "Low Claim")
 
Best Answer chosen by mluisi
Sai PraveenSai Praveen (Salesforce Developers) 
Hi,

For the above one you have to end the AND() before assiging it like below.
 
IF(AND(

OR(
    Account.BillingState = "AR",
    Account.BillingState = "GA",
    Account.BillingState = "KS",
    Account.BillingState = "MI",
    Account.BillingState = "WA"),
OR(
    ISPICKVAL(Resident_Water_Responsibility__c, "from the main to the home."),
    ISPICKVAL(Resident_Water_Responsibility__c, "from the main to the shut-off valves of the home's  interior supply lines."))),High Claim w/ Water Extension", " ")

Similary extend it for remainign as well.

Let me know if you face any issues.

If this solution helps, Please mark it as best answer.

Thanks,

All Answers

Sai PraveenSai Praveen (Salesforce Developers) 
Hi,

As you highlited in bold for the below line . Can I know why this highlited is added. If you want to check OR condition for 
AND(OR(
    ISPICKVAL(Resident_Water_Responsibility__c, "from the main to the home."),
    ISPICKVAL(Resident_Water_Responsibility__c, "from the main to the shut-off valves of the home's interior supply lines.")),
    "High Claim w/ Water Extension"),

The AND() should get output as boolean and we have to compare the values and get the output but the highlited part you are like assigning it.


Let me know if you face any issues.

If this solution helps, Please mark it as best answer.

Thanks,
mluisimluisi
Thanks for your response. I bolded what was highlighted when the error occured. See pic attached.

This is a formula field. I want to assign the bolded value when another field is equal to one of the values in the two OR statements before it. This is why I used the AND.. How should I do that, please? IF the first OR statement is true AND the second OR statement is true than populate the field with this value else....

IF(AND(

OR(
    Account.BillingState = "AR",
    Account.BillingState = "GA",
    Account.BillingState = "KS",
    Account.BillingState = "MI",
    Account.BillingState = "WA"),
OR(
    ISPICKVAL(Resident_Water_Responsibility__c, "from the main to the home."),
    ISPICKVAL(Resident_Water_Responsibility__c, "from the main to the shut-off valves of the home's interior supply lines.")),
   
User-added image "High Claim w/ Water Extension", " "))
Sai PraveenSai Praveen (Salesforce Developers) 
Hi,

For the above one you have to end the AND() before assiging it like below.
 
IF(AND(

OR(
    Account.BillingState = "AR",
    Account.BillingState = "GA",
    Account.BillingState = "KS",
    Account.BillingState = "MI",
    Account.BillingState = "WA"),
OR(
    ISPICKVAL(Resident_Water_Responsibility__c, "from the main to the home."),
    ISPICKVAL(Resident_Water_Responsibility__c, "from the main to the shut-off valves of the home's  interior supply lines."))),High Claim w/ Water Extension", " ")

Similary extend it for remainign as well.

Let me know if you face any issues.

If this solution helps, Please mark it as best answer.

Thanks,
This was selected as the best answer
mluisimluisi
User-added image