As mentioned in the error, IF
function expects 3 parameters
IF(logical_test, value_if_true, value_if_false)
- Condition to evaluate i.e. logical test.
- What should be the value if the condition evaluates to true.
- What should be the value if the condition evaluates to false.
In your above formula, you did not mention what should happen when it does not match any of the mentioned statuses. Also you have not closed your IFs
braces properly. I updated the else
condition in your below formula to dummy image, you can replace it with the one which you want to display.
IMAGE(
IF(ISPICKVAL(Flat_Status__c, "Booked"), "img/msg_icons/confirm32.png",
IF(ISPICKVAL(Flat_Status__c, "Sold"), "img/msg_icons/error32.png",
IF(ISPICKVAL(Flat_Status__c, "Non-Serviced"), "img/msg_icons/warning32.png",
IF(etc...., "img/msg_icons/falseconditonimage.png"))))
)
Instead of using IF
function, you can use CASE
function here which is much simpler to understand and maintain.
Excerpt from this salesforce help link
Use CASE functions to determine if a picklist value is equal to a
particular value.
Using CASE
function, your formula would be
IMAGE(
CASE(Flat_Status__c,
"Booked", "img/msg_icons/confirm32.png",
"Sold", "img/msg_icons/error32.png",
"Non-Serviced", "img/msg_icons/warning32.png",
"etc", "img/msg_icons/warning33.png",
"img/msg_icons/falseconditonimage.png")
)
You can find the documentation for using CASE
function with picklist field at this link.