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
Gagan SHARMA 25Gagan SHARMA 25 

Error: Incorrect parameter type for function 'OR()'. Expected Boolean, received Number

I have created one custom field which is Commission, over there i am trying to calculate commission. IF LeadSource is web and Amount is greter than 1000. Then commission should be 2% of amount. Other wise it should be 1% of Amount.
IF LeadSource is Phone Inquiry and Amount is greater than 50000 then the commission should be 10% of Amount. Other wise 5% of Amount.

OR(IF(AND(ISPICKVAL( LeadSource , "Phone Inquiry"),  Amount  < 50001) ,  Amount  * 10 / 100 , Amount  * 5 / 100 ),IF(AND(ISPICKVAL( LeadSource , "Web"),  Amount  < 1001) ,  Amount  * 2 / 100 , Amount  * 1 / 100 ))
Andrew GAndrew G
Within your OR statement, you have 2 x IF statements that produce a numeric outcome.   The OR statement is a Logic test.  It is looking for a boolean value of either True or False.

Even if the OR statement could cope with the Numeric, or you just removed the OR statement, the structure of your Formula would give incorrect results.
It will have to be a twice nested IF statement across both logic tests.

 
Alka YadavAlka Yadav
Thanks for sharing helpful information.
Jankalyan Portal (https://www.jankalyanportal.in/)
Andrew GAndrew G
had some time to look at the formula
 
IF(
  ISPICKVAL( LeadSource , "Phone Inquiry"),
    IF(
      Amount  < 50001,  
      Amount  * 10 / 100 , 
      Amount  * 5 / 100 
    ),
  IF(
    ISPICKVAL( LeadSource , "Web"),  
      IF( Amount  < 1001,
        Amount  * 2 / 100, 
        Amount  * 1 / 100
      ),
  0 
  )
)

regards
Andrew