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
janeisaacjaneisaac 

2 IF/OR Statements and a Boolean Error

I am trying to create a formula that has three possible results:

a Yellow light,

a Red Light,

or a Green Light.

 

I currently have 2 different fields - each with their own formula. One has the YELLOW light formula, which is the first 6 lines of this below and the other fields uses the Red Light Formula, which is the last 8 lines of the formula. On their own, updating 2 different fields, each of these formulas work as expected. But I need them to work on ONE field.

 

Of course I had to try it, but I really expected that simply combining the two formulas was too easy an option to work right off the bat, so here I am, asking for the help of my Formula Wizards. I am getting the Error on the Function OR in the first line, saying it expected Boolean, received Text.

 

Can someone help me fix this?

 

Jane

 

 

OR(
IF(
     Test_Terms_Update__c =TRUE,
    IMAGE("https://c.cs7.content.force.com/servlet/servlet.FileDownload?file=015M000000057ze","Yellow"),
    IMAGE("/img/samples/flag_green.gif","Green")
),
IF(
OR(
Credit_Hold__c,
Permanent_Hold__c
),
IMAGE("/servlet/servlet.FileDownload?file=015C00000010ljS","Red"),
IMAGE("/img/samples/flag_green.gif","Green")
))



Best Answer chosen by Admin (Salesforce Developers) 
Steve :-/Steve :-/

Here you go Jane

IF(Test_Terms_Update__c =TRUE,IMAGE("https://c.cs7.content.force.com/servlet/servlet.FileDownload?file=015M000000057ze","Yellow"),
IF(OR(Credit_Hold__c,Permanent_Hold__c),IMAGE("/servlet/servlet.FileDownload?file=015C00000010ljS","Red"),
IMAGE("/img/samples/flag_green.gif","Green")))

 

All Answers

Steve :-/Steve :-/

Here you go Jane

IF(Test_Terms_Update__c =TRUE,IMAGE("https://c.cs7.content.force.com/servlet/servlet.FileDownload?file=015M000000057ze","Yellow"),
IF(OR(Credit_Hold__c,Permanent_Hold__c),IMAGE("/servlet/servlet.FileDownload?file=015C00000010ljS","Red"),
IMAGE("/img/samples/flag_green.gif","Green")))

 

This was selected as the best answer
janeisaacjaneisaac

As usual, you save the day - thanks so much Steve!

Steve :-/Steve :-/

Thanks!  what do I win?  ;-)

 

One other thing, make sure that IF statements are mutually exclusive by design, so make sure that IF1 and IF2 are in the proper order. 

janeisaacjaneisaac

You will just have to wait and see what you win, won't you?

 

When you say to make sure they are in the right order, do you mean that the one that should take precedence should be first in the formula?  We would want the RED light to be the higher priority - so if they qualified for both Yellow and Red, we would want the light to be the Red light.

 

How would that look in the formula?

Steve :-/Steve :-/

Exactly!  So for example if you were using an IF statement to assign a grade and you said:

IF(Score >= 60, D,
IF(Score >= 70, C, 
IF(Score >= 80, B, 
IF(Score >= 90, A, 
F)))) 

 nobody with a score >= 70 could get a C, B, or A, because they'd ALL fall into the IF1 bucket.

 

so you'd want to do either

 

IF(Score < 60, F,
IF(Score < 70, D, 
IF(Score < 80, C, 
IF(Score < 90, B, 
A)))) 

or

IF(Score >= 90, A,
IF(Score >= 80, B, 
IF(Score >= 70, C, 
IF(Score >= 60, D, 
F))))