0

I have a field "Account__r.Commission_Rate__c" and depending on the value of this % field, I want to show a coloured flag.

If the % is 0-5, the red flag needs to display. If the % if 5-10, the yellow flag needs to display. If the % is 10+, the green flag needs to display.

The below formula compiles but doesn't work. The red flag appears but never updates upon save no matter the commission value. Any advice on how it can be improved/solved?

IF(AND(Account__r.Commission_Rate__c >= 0, Account__r.Commission_Rate__c < 5), IMAGE("/img/samples/flag_red.gif",""),
IF(AND(Account__r.Commission_Rate__c >= 5, Account__r.Commission_Rate__c < 10), IMAGE("/img/samples/flag_yellow.gif",""),
IF(Account__r.Commission_Rate__c > 10, IMAGE("/img/samples/flag_green.gif","/s.gif"),
"")))

Any help appreciated!

1
  • The formula looks correct. Doublecheck to make sure that a. flag_yellow.gif and flag_green.gif are not actually red flags, b. That the Account__r.Commission_Rate__c rate contains the correct value. Mar 10, 2021 at 16:27

1 Answer 1

1

If you look at what you get back out of the field, you'll find it's going to be 0.05 for 5%, 0.1 for 10%, etc.

It's always red because the value is always between 0 and 5 (it's actually always between 0 and 1).

For example:

IF(AND(My_Percent__c >= 0.05, My_Percent__c < 0.10), "greater than or equal to 0.05, less than 0.10", IF(AND(My_Percent__c >= 0.10, My_Percent__c < 0.5), "greater than or equal to 0.10, less than 0.5", "equal to or greater than 0.5"))

10 percent

25 percent

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.