The if() function allows for a conditional evaluation that returns a boolean (i.e., true or false). Depending on the result, one of two expressions is run.
Syntax
if(condition, if true, if false)
Argument | Description |
condition
(required) |
The condition to be evaluated and that returns a boolean. |
value if true
(required) |
The value (i.e., a hard-coded value, a reference to an attribute, or a function that returns a value) to return if the condition is true. |
value if false
(required) |
The value (i.e., a hard-coded value, a reference to an attribute, or a function that returns a value) to return if the condition is false. |
Where Available
Available in all places the expression or injected expression icon is visible, as well as within Filter fields on Cards, Tables and List/View sections.
Examples
Where | Example(s) |
Field Editability expression
Tab Visibility expression Business rules: Condition |
if(Business_Unit__c="East",Num1__c,Num2__c) > 15
|
Dynamic Expression
Notification Body Notification Subject |
{!if(Status_Color__c="Red",Num1__c,Num2__c)}
|
Business rules: Set Value
Attribute expression |
if(Status_Color__c="Red",Num1__c,Num2__c) |
Embedded Section URL attribute
Business Rules: Call URL External View URL on List/View |
{!if(News_Source__c="ABC","https://abcnews.go.com/","https://www.nbcnews.com")}
|
Metric Expression | if(Stage_Gate__c="2",CAPEX__m,Total_Expense__m)
If the current quarter OpEx metric holds an Actual value, average the current and past three quarters, else average the past 3 quarters. |