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
RichardR1RichardR1 

Error: Incorrect parameter type for function 'OR()'

Sorry in advance, the string below is long. I don't know why I got the error message "Error: Incorrect parameter type for function 'OR()'. Expected Boolean, received Text"

OR(
    IF(
       AND(
           OR(
              PE_company__c = FALSE ,
              PE_Portfolio_Company__c = FALSE
              ) ,
           OR(
              CONTAINS(LinkedIn_Company_Size__c ,'Self-employed') ,
              CONTAINS(LinkedIn_Company_Size__c ,'2-10 employees') ,
              CONTAINS(LinkedIn_Company_Size__c ,'N/A') ,
              CONTAINS(LinkedIn_Company_Size__c ,'') 
              )
           ) ,
       
       '0.5' , '0'
       ) ,

    IF(
       OR(
          AND(
              Years_of_work_exp__c  >= 8 ,
              NOT(
                  OR(
                     CONTAINS(LinkedIn_Company_Size__c ,'Self-employed') ,
                     CONTAINS(LinkedIn_Company_Size__c ,'2-10 employees') ,
                     CONTAINS(LinkedIn_Company_Size__c ,'11-50 employees') ,
                     CONTAINS(LinkedIn_Company_Size__c ,'N/A') ,
                     CONTAINS(LinkedIn_Company_Size__c ,'') 
                     )
                  )
              ) ,
          OR(
             CONTAINS( Current_Title__c , 'director') ,
             CONTAINS( Current_Title__c , 'vice president') ,
             CONTAINS( Current_Title__c , 'president') ,
             CONTAINS( Current_Title__c , 'general manager') ,
             CONTAINS( Current_Title__c , 'chief') ,
             CONTAINS( Current_Title__c , 'officer') ,
             CONTAINS( Current_Title__c , 'CEO') ,
             CONTAINS( Current_Title__c , 'COO') ,
             CONTAINS( Current_Title__c , 'CSO') ,
             CONTAINS( Current_Title__c , 'CTO') ,
             CONTAINS( Current_Title__c , 'CFO') ,
             CONTAINS( Current_Title__c , 'CHRO') ,
             CONTAINS( Current_Title__c , 'SVP') ,
             CONTAINS( Current_Title__c , 'EVP') 
             )
          ) ,

       '1', '0'
       ) ,
    
    IF(
       AND(
           OR(
              PE_company__c = TRUE ,
              PE_Portfolio_Company__c = TRUE
              ) ,
           OR(
              Years_of_work_exp__c  >= 8 ,
              CONTAINS( Current_Title__c , 'managing director') ,
              CONTAINS( Current_Title__c , 'principal') ,
              CONTAINS( Current_Title__c , 'vice president') ,
              CONTAINS( Current_Title__c , 'president') ,
              CONTAINS( Current_Title__c , 'vp') ,
              CONTAINS( Current_Title__c , 'operating') ,
              CONTAINS( Current_Title__c , 'partner') ,
              CONTAINS( Current_Title__c , 'executive') ,
              CONTAINS( Current_Title__c , 'chief') ,
              CONTAINS( Current_Title__c , 'general manager') ,
              CONTAINS( Current_Title__c , 'officer') ,
              CONTAINS( Current_Title__c , 'CEO') ,
              CONTAINS( Current_Title__c , 'COO') ,
              CONTAINS( Current_Title__c , 'CSO') ,
              CONTAINS( Current_Title__c , 'CTO') ,
              CONTAINS( Current_Title__c , 'CFO') ,
              CONTAINS( Current_Title__c , 'CHRO') ,
              CONTAINS( Current_Title__c , 'Director') ,
              CONTAINS( Current_Title__c , 'Portfolio operations') ,
              CONTAINS( Current_Title__c , 'Talent') ,
              CONTAINS( Current_Title__c , 'Chief talent officer') ,
              CONTAINS( Current_Title__c , 'Head of HR') ,
              CONTAINS( Current_Title__c , 'SVP') ,
              CONTAINS( Current_Title__c , 'EVP') 
              )
           ) ,

       '2', '0'
       )
   )

Thanks,

Richard
Best Answer chosen by RichardR1
Alain CabonAlain Cabon
OR ( condition1 , condition2,  condition3 )  = condition 1,2 and 3 only return true or false and the complete OR ( ) also returns true or false.

The first IF (condition1) can return '0.5' or '0' that are strings.

That could work if that was TRUE, FALSE instead of  '0.5' , '0'.

OR ( IF ( ... ) , IF ( ... ) ) is equivalent to IF ( ... ) || IF ( ... )  and only returns TRUE or FALSE ( boolean, checkbox type ).

You need to use nested IF.

IF ( condition1, result1, IF ( condition2, result2, IF (condition3, result3, <default value> )))  : can return a boolean, a string or a date, etc. 
 

All Answers

Alain CabonAlain Cabon
OR ( condition1 , condition2,  condition3 )  = condition 1,2 and 3 only return true or false and the complete OR ( ) also returns true or false.

The first IF (condition1) can return '0.5' or '0' that are strings.

That could work if that was TRUE, FALSE instead of  '0.5' , '0'.

OR ( IF ( ... ) , IF ( ... ) ) is equivalent to IF ( ... ) || IF ( ... )  and only returns TRUE or FALSE ( boolean, checkbox type ).

You need to use nested IF.

IF ( condition1, result1, IF ( condition2, result2, IF (condition3, result3, <default value> )))  : can return a boolean, a string or a date, etc. 
 
This was selected as the best answer
RichardR1RichardR1
Thanks for explaining. I will try this and provide update in a few days.
Ajay K DubediAjay K Dubedi
Hi Richard,

I have understood your problem and also found a mistake. Firstly I didn't get, what you want with this formula? What do you expect the output?

 
1.  You have an outer OR() function which expects only boolean(true, false);
    The first If() function:

     IF(
       AND(
           OR(
              PE_company__c = FALSE ,
              PE_Portfolio_Company__c = FALSE
              ) ,
           OR(
              CONTAINS(LinkedIn_Company_Size__c ,'Self-employed') ,
              CONTAINS(LinkedIn_Company_Size__c ,'2-10 employees') ,
              CONTAINS(LinkedIn_Company_Size__c ,'N/A') ,
              CONTAINS(LinkedIn_Company_Size__c ,'') 
              )
           ) ,
       
       '0.5' , '0'
       ) ,

  Output- '0.5' or '0'  (In text format).

2. Second If() function:
     IF(
       OR(
          AND(
              Years_of_work_exp__c  >= 8 ,
              NOT(
                  OR(
                     CONTAINS(LinkedIn_Company_Size__c ,'Self-employed') ,
                     CONTAINS(LinkedIn_Company_Size__c ,'2-10 employees') ,
                     CONTAINS(LinkedIn_Company_Size__c ,'11-50 employees') ,
                     CONTAINS(LinkedIn_Company_Size__c ,'N/A') ,
                     CONTAINS(LinkedIn_Company_Size__c ,'') 
                     )
                  )
              ) ,
          OR(
             CONTAINS( Current_Title__c , 'director') ,
             CONTAINS( Current_Title__c , 'vice president') ,
             CONTAINS( Current_Title__c , 'president') ,
             CONTAINS( Current_Title__c , 'general manager') ,
             CONTAINS( Current_Title__c , 'chief') ,
             CONTAINS( Current_Title__c , 'officer') ,
             CONTAINS( Current_Title__c , 'CEO') ,
             CONTAINS( Current_Title__c , 'COO') ,
             CONTAINS( Current_Title__c , 'CSO') ,
             CONTAINS( Current_Title__c , 'CTO') ,
             CONTAINS( Current_Title__c , 'CFO') ,
             CONTAINS( Current_Title__c , 'CHRO') ,
             CONTAINS( Current_Title__c , 'SVP') ,
             CONTAINS( Current_Title__c , 'EVP') 
             )
          ) ,

       '1', '0'
       ) ,

    Output -  '1' Or '0' (In text format).


3. The 3rd If() function :
    IF(
       AND(
           OR(
              PE_company__c = TRUE ,
              PE_Portfolio_Company__c = TRUE
              ) ,
           OR(
              Years_of_work_exp__c  >= 8 ,
              CONTAINS( Current_Title__c , 'managing director') ,
              CONTAINS( Current_Title__c , 'principal') ,
              CONTAINS( Current_Title__c , 'vice president') ,
              CONTAINS( Current_Title__c , 'president') ,
              CONTAINS( Current_Title__c , 'vp') ,
              CONTAINS( Current_Title__c , 'operating') ,
              CONTAINS( Current_Title__c , 'partner') ,
              CONTAINS( Current_Title__c , 'executive') ,
              CONTAINS( Current_Title__c , 'chief') ,
              CONTAINS( Current_Title__c , 'general manager') ,
              CONTAINS( Current_Title__c , 'officer') ,
              CONTAINS( Current_Title__c , 'CEO') ,
              CONTAINS( Current_Title__c , 'COO') ,
              CONTAINS( Current_Title__c , 'CSO') ,
              CONTAINS( Current_Title__c , 'CTO') ,
              CONTAINS( Current_Title__c , 'CFO') ,
              CONTAINS( Current_Title__c , 'CHRO') ,
              CONTAINS( Current_Title__c , 'Director') ,
              CONTAINS( Current_Title__c , 'Portfolio operations') ,
              CONTAINS( Current_Title__c , 'Talent') ,
              CONTAINS( Current_Title__c , 'Chief talent officer') ,
              CONTAINS( Current_Title__c , 'Head of HR') ,
              CONTAINS( Current_Title__c , 'SVP') ,
              CONTAINS( Current_Title__c , 'EVP') 
              )
           ) ,

       '2', '0'
       )
    Output:  '2' Or '0'  (In text format)

Final result:  OR(('0.5' or '0') , ('1' Or '0')  , ('2' Or '0'))


Here all three arguments returns Text format but OR() function wants boolean type. That's why you 
are getting the error:
Error: Incorrect parameter type for function 'OR()'. Expected Boolean, received Text"

You should change the return values accordingly.
If you have more queries, then feel free to ask.

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com