Thursday, July 24, 2014

Display images in salesforce formula field.

Display images in salesforce formula field.



Here i have a small requirement that i need to display priority image on opportunity based on opportunity amount, to achieve that i created a formula field on opportunity object and display the images.

For this you need to be an administrator or should have the permissions to modify Objects.

Following are the Steps:

1) Upload the Image to Salesforce
  •     Navigate to the documents tab 





    • Fill in the details of your file, make it externally available and click save 
    • Once the image is saved, keep a note of its record id, which can be found on the URL(ex: 015U0000000HxC9)
    save image





       2) Now we need to add a custom field to the object where we need to display the image, here I am adding the field to a custom object
    • Navigate to Setup--> Customize--> Opportunity-->  Add new Custom field
    • On Step 1 Select the field type as “formula” and click next
    • On Step 2 Select the Field Return type as “Text”
    • On step 3 Select the Advanced Formula


    Specify the condition on which the image is to be displayed. E.g. I want to display this image when my Amount field is with some values like,

    IF(Amount>=20000,  IMAGE("/servlet/servlet.FileDownload?file=01590000004APPm","", 25,25) , IF(Amount>=15000 && Amount <20000,  IMAGE("/servlet/servlet.FileDownload?file=01590000004APPX","", 25,25) , IF(Amount>=10000 && Amount <15000,  IMAGE("/servlet/servlet.FileDownload?file=01590000004APPS","", 25,25),IF(Amount>=5000 && Amount <10000,  IMAGE("/servlet/servlet.FileDownload?file=01590000004APP4","", 25,25), IMAGE("/servlet/servlet.FileDownload?file=01590000004APP8","", 25,25)))))


    • On Step 4 & 5 select the settings you wish and click save.

    save image

    Once you done all this you will get a page like this.





    0 comments:

    Post a Comment

     
    | ,