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
Gary AllenGary Allen 

How do I get two different conditions in one formula field where one condition supersedes the other?


Two different conditions in one formula field.

IF( 
AND( 
NOT( 
ISBLANK(Under_Current_Contract_Until__c)), 
Under_Current_Contract_Until__c >=TODAY(), 
Owner.LastName <> "Partners"), 
IMAGE("/img/samples/color_red.gif", "red", 30, 30), 
IMAGE("/img/samples/color_green.gif", "green", 30, 30))

I need to incorporate these parameters into the formula
above. These two conditions need to always be red.

RecordType.DeveloperName = "Phase 4,
Owner.LastName <> "Partners"

In other words I need these two parameters to supersede the other conditions.
I have tried OR statements and nested IF statements without success.

Any help would be appreciated. Thanks!
Patcs_1Patcs_1
Hi

You can try like this,

IF( 
AND( 
NOT(ISBLANK(Under_Current_Contract_Until__c)), 
Under_Current_Contract_Until__c >=TODAY(), 
Owner.LastName <> "Partners", RecordType.DeveloperName = "Phase 4"),
IMAGE("/img/samples/color_red.gif", "red", 30, 30), 
IMAGE("/img/samples/color_green.gif", "green", 30, 30))

Hope this helps!

Thanks
Gary AllenGary Allen
As a test I am using an opportunity where the "Under_Current_Contract_Until__c" does not meet the 
criteria but still comes up red becasuse it is a phase 4 and owner <> "Partners". When I tried your 
solution it came up green.
SalesFORCE_enFORCErSalesFORCE_enFORCEr
IF( 
AND( 
Owner.LastName <> "Partners", RecordType.DeveloperName = "Phase 4"
),
IMAGE("/img/samples/color_red.gif", "red", 30, 30), 
IF(
AND(
NOT(ISBLANK(Under_Current_Contract_Until__c)), Under_Current_Contract_Until__c>=TODAY(),
Owner.LastName <> "Partners"
),
IMAGE("/img/samples/color_red.gif", "red", 30, 30), 
IMAGE("/img/samples/color_green.gif", "green", 30, 30)))

 
Gary AllenGary Allen
As a test I have an opportunity that does not meet the criteria of “Under_Current_Contract_Until__c >=TODAY() “ but does meet “Owner.LastName
SalesFORCE_enFORCErSalesFORCE_enFORCEr
In that case, if the record type is Phase 4 it will be Red else Green.
Gary AllenGary Allen
If criteria is met for both parameters in line 03 color needs to be red regardless of what follows. IF( 02 AND( 03 Owner.LastName
SalesFORCE_enFORCErSalesFORCE_enFORCEr
Yes, is it not Red when Owner.LastName <> "Partners", RecordType.DeveloperName = "Phase 4"?
Gary AllenGary Allen
This is the formula I am using now and the status color is still green. When I change the Under contract until to greater than today it turns To red. I want it to be red regardless of any other line in the formula When the first IF statement is met. When I look at this formula I don’t understand why it doesn’t work. Logically it looks like it should. IF( AND( Owner.LastName =TODAY(), Owner.LastName