Activity Forums Salesforce® Discussions How to display image of picklist by formula field by using direct URL in Salesforce?

  • Avnish Yadav

    Member
    August 6, 2018 at 4:50 am

    Hello Anjali,

    You will need to use a nested if formula.

    Something like this

    IMAGE(
    IF(ISPICKVAL(API__c, "Confirm"), "img/msg_icons/confirm32.png",
    IF(ISPICKVAL(API__c, "Error"), "img/msg_icons/error32.png",
    IF(ISPICKVAL(API__c, "Warning"), "img/msg_icons/warning32.png"),
    IF(etc....))
    )
    )
    Or you can also try out the case formula that will be much easier.

    IMAGE(
    CASE(API__c,
    "Confirm", "img/msg_icons/confirm32.png",
    "Error", "img/msg_icons/error32.png",
    "Warning", "img/msg_icons/warning32.png",
    "Info", "img/msg_icons/info32.png",
    "/s.gif"),
    "Status")

    API__c is the API Name of the picklist field that you want to base upon.

    Thanks.

  • Parul

    Member
    September 23, 2018 at 8:50 am

    First, you need to upload the image file to Documents, make it available for external use, and then capture it's ID from the address bar. Reference it in the formula below DocumentID. Replace Image Name with the word(s) you want to appear if the Image cannot be displayed. Replace Custom_URL_Field__c with the field name of your URL field.

    HYPERLINK(Custom_URL_Field__c, IMAGE("servlet/servlet.FileDownload?file=DocumentID", "Image Name"))

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos