I have an if/then formula to update because it is currently referencing a checkbox field that is no longer used for our Opportunities. The field that is used now is a formula field on the Opportunity that is derived from a field on the Account.

<apex:outputText value="{!IF(Opportunity.PO_Required__c, 'Yes', 'No')}" />
PO Number:&nbsp;<apex:outputText value="{!Opportunity.PO_Number__c}" />

Opportunity.PO_Required__c is the formula field being derived from an account field. PO Number is the field that is outputted if Opportunity.PO_Required__c equals Yes.

​I keep getting this error:

Incorrect parameter type for function 'IF()'. Expected Boolean, received Text

I am not a developer, but have done some updates to previous Apex code and am trying to learn more.

1 Answer 1


The first value of "IF" must be a Boolean value. Checkboxes are already Boolean, but other types require an "operator", one of "=" (equal to), "<>" (not equal to), "<" (less than), ">" (greater than), "<=" (less than or equal to), or ">=" (greater than or equal to).

You're also apparently generally confused about how "value" and "apex:outputText" works. Since you're trying to conditionally render a value, you need to use "rendered" instead of "value":

<apex:outputText rendered="{!Opportunity.PO_Required__c='Yes'}">
  PO Number:&nbsp;<apex:outputText value="{!Opportunity.PO_Number__c}" />

Note that "IF" isn't required here; the "=" operator returns "true" when PO_Required__c is equal to "yes" (case-insensitive), and "false" otherwise. If rendered is true, the text will show.

You must log in to answer this question.

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