It's very common requirement to display images for a specific field value in a record, as pictorial representation will be more conveying than text.
For example, to display Status of a record pictorially, lets have some rule as
To implement this requirement in Salesforce, we have to store images in Salesforce , either in Documents or Static Resources and then, using Formula Field in the object, by comparing data of the actual field, we will set Image relative path of the stored images
Step 2: Add this zip file to the static resources and set the access of it as public
Step 3: Open the Object in which we need to set the images and create a Choice field to select Status and then a new Formula field to set image according to the data of the created Choice Field
For example, to display Status of a record pictorially, lets have some rule as
- If status Open - display Green image
- If status Planning - display Amber image
- If status Closed - display Red image
To implement this requirement in Salesforce, we have to store images in Salesforce , either in Documents or Static Resources and then, using Formula Field in the object, by comparing data of the actual field, we will set Image relative path of the stored images
Lets do step by step as shown as below
Step 1 : Create images with the 3 colors as required and zip them.
Step 2: Add this zip file to the static resources and set the access of it as public
To do this , follow below steps
- Login to salesforce environment and Go to Setup
- Under Build, select 'Develop' and then 'Static Resources'
- Click on New and fill in the required information by uploading the Zipped file
- select Cache Control 'Public' and save
Step 3: Open the Object in which we need to set the images and create a Choice field to select Status and then a new Formula field to set image according to the data of the created Choice Field
To do this, follow below steps
- Go to Setup
- Under Build, Select 'Create' and then 'Objects'
- List of all objects displayed. Click the object in which we need to create these fields
- Go to Custom Fields section and click 'New'
- Choose 'Picklist' for Data type and provide required information as below
- Save it and then in similar way click on 'New' in Custom Fields section and for Data type, choose 'Formula'
- Provide Field name and label, then select Return type as 'Text'
- Now, under 'Advanced Formula' section, write formula as below
IMAGE(CASE( Status__c , 'Open', '/resource/status/green.png', 'Closed', '/resource/status/red.png', 'Planning', '/resource/status/yellow.png', ''), "rating")
- And, for Blank Field Handling, select Treat blank fields as blanks'
- Provide the required access and also add it into the layouts