function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
manliamanlia 

Color formula

Hi,

 

Is there anyway to do a formula based on colors (not the traffic light image)?

I need to have more than 3 colors to show depending on the Rating Status, such as Gren, Yellow, Red, and Purple to show these colors when the rating is selected for each one.

 

Thanks,

Lia

Steve :-/Steve :-/
Do you mean that you want to have the color automatically generated using the RGB Hex Value instead of referencing a stored image file?  or are you looking for something else?  
manliamanlia

I've never used a stored image file.  Are you talking storing the image file in the "document" folder?

I'm not familiar with this step and not sure where I could get those colors and which formulas to use either.   The goal is to have the color automatically changing when a different rating field is selected. 

So, I think any way that will be the easiest will be preferred.

Thank you fory our help! Lia

Steve :-/Steve :-/

Here is a Formula Field that I built to display a colored light based on the status selected from a picklist field.  

The images are stored as a document records on my SFDC.Org.  

The file=xxxxxxxxxxxxxxx refers to the record ID of the image document.

 

CASE(Status__c ,

"1.Green", IMAGE( "/servlet/servlet.FileDownload?file=01540000000JaGp", "Green"),

"2.Yellow", IMAGE( "/servlet/servlet.FileDownload?file=01540000000JaGz", "Yellow"),

"3.Red", IMAGE( "/servlet/servlet.FileDownload?file=01540000000JaH4", "Red"),

"4.Blue", IMAGE( "/servlet/servlet.FileDownload?file=01540000000JaGu", "Blue"),

"")

 

 

 

 

 

 

Here are some other examples of Rating Formula that you could modify to refer to a color image 

 

 

Stars for RatingsThis formula displays a set of one to five stars to indicate a rating or score.

 

IMAGE( CASE(Rating__c,

"1", "/img/samples/stars_100.gif",

"2", "/img/samples/stars_200.gif",

"3", "/img/samples/stars_300.gif",

"4", "/img/samples/stars_400.gif",

"5", "/img/samples/stars_500.gif", "/img/samples/stars_000.gif"),

"rating")

 

For details about using these functions, see IMAGE and CASE.Consumer Reports™-Style Colored Circles for RatingsThis formula displays a colored circle to indicate a rating on a scale of one to five, where solid red is one, half red is two, black outline is three, half black is four, and solid black is five.

 

IMAGE( CASE(Rating__c,

"1", "/img/samples/rating1.gif",

"2", "/img/samples/rating2.gif",

"3", "/img/samples/rating3.gif",

"4", "/img/samples/rating4.gif",

"5", "/img/samples/rating5.gif", "/s.gif"),

"rating")

https://na2.salesforce.com/help/doc/en/salesforce_useful_formula_fields.pdf

 

 

 

 

Message Edited by Stevemo on 03-29-2010 02:53 PM
Message Edited by Stevemo on 03-29-2010 02:53 PM
manliamanlia
I will try that.  Thanks!
Steve :-/Steve :-/

Have you had any luck with this, or do you need any additional help?

SunnykoolSunnykool

Hi Steve,

Even I am looking for accessing image fields in Formulae fields. The problem is it works fine in dev org where i used the sample image and formuale thing as given by Standard SFDC. but it fails when i prepare a manage package out of it. i think the namespace prefix must be appended there. Any idea how can ibypass this without appending name space prefix

Steve :-/Steve :-/

@SunnyKool I don't have a ton of experience with Packages.  Can you post the formula that you are using?  Does the formula refer to Record ID's or file names? 

SunnykoolSunnykool

Basically on basis of some values, i show an image.

For eg :

This doesnt work

IF(Current_Discount__c <10) ,IMAGE("/resource/staticResourceName/icons/yellow_dot.jpeg", "yellowIcon")

 

This works if namespace is appended : Sample namespace = sp

IF(Current_Discount__c <10) ,IMAGE("/resource/sp__staticResourceName/icons/yellow_dot.jpeg", "yellowIcon")

Steve :-/Steve :-/

When you say "doesn't work" does the formula not display the appropriate image?  Or are you getting a duplicate error when you install the Package?  

SunnykoolSunnykool

Doesn't work means it wont show me the image as if SF is not able to find the path of the image.

Formuale gets executed ans it shows the alt name of the image.In my eg, it would show "yellowIcon"

Apps HeroApps Hero

This is working for me.  I just copied the script in my formula and it just worked.  I did not save any images.  I have another issue

My display is Average Raging.  So the average comes with Decimal(ex: 3.5)  In this casa How can I half color the 4th image.

Please help

George Thomas

SunnykoolSunnykool

Hi,

Are you using standard Salesforce Images or your custom images stored in Static Resources ??

Apps HeroApps Hero

I simly use the following code. in ithe formula.  Standard image

 

IMAGE( CASE(Rating__c,

"1", "/img/samples/stars_100.gif",

"2", "/img/samples/stars_200.gif",

"3", "/img/samples/stars_300.gif",

"4", "/img/samples/stars_400.gif",

"5", "/img/samples/stars_500.gif", "/img/samples/stars_000.gif"),

"rating")

 

George