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
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdHWsygVY-k6m4G6MouqKpzU30hk_94JN9EOcmhXFUr3sokJ6beuR8LChECprUlrveU2X03J45DZregbv6tYkrpLXov96_PIgeg530-v4SLdwpRSDOETG1jFmWxCCol_nqJHSPVMiR5wc/s640/Documents.png)
- 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)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTl7ESVL53Ei1NaW6O3063l8J2eEevBWLm8NgxbXc4zNK-RWGt01oY_zrrKXTLJjd6W6WQY0bgK2hvoNdOzYQrsUqGyRfGxF50dlZqI61wS7IFbtQXaI6JlAszWuYXPQnX9SNXGILVi9o/s640/SalesforceURL.png)
- 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.
Once you done all this you will get a page like this.
0 comments:
Post a Comment