1
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....))
)
)

i get an error as -

Error: Incorrect number of parameters for function 'IF()'. Expected 3, received 2

Any Help or suggestion would be Highly appreciated

1 Answer 1

1

As mentioned in the error, IF function expects 3 parameters

IF(logical_test, value_if_true, value_if_false)

  1. Condition to evaluate i.e. logical test.
  2. What should be the value if the condition evaluates to true.
  3. 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.

1
  • Thank you very much for sharing the Link Mr Vijay, it solved my problem:) Commented Apr 26, 2019 at 13:06

You must log in to answer this question.

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