You're not using ISPICKVAL()
correctly.
Taking a look at the documentation for ISPICKVAL()
, you'll see that it takes 2 parameters: the picklist field, and the value you want to check.
Note that you can only check if a picklist is currently a certain value. There is no ISNOTPICKVAL()
function. To do what you want to do, you need to first use ISPICKVAL()
to say that Reason_for_Reopen__c
is AUTO REPLY EML. Then you can wrap that in a NOT()
to get the "reopen reason is not auto reply email" that you want.
IF(
AND(
IsClosed = TRUE ,
First_Response_Time__c != NULL
),
'FCR Met',
IF(
AND(
/* You need to get rid of the "!=" and use a comma so that */
/* you're passing the correct number (and type) of parameters */
/* Then, wrap it in a NOT() so that you end up with the behavior of != */
NOT(ISPICKVAL(Reason_for_Reopen__c, 'AUTO REPLY EML')),
First_Response_Time__c != NULL
),
'FCR Met',
'FCR Not Met'
)
)
Alternatively, TEXT(Reason_for_Reopen__c) != 'AUTO REPLY EML
would also work
You can also merge the conditions for the first and second IF()
to remove the second one1.
IF(
/* Knowing when to use AND() and when to use OR() takes a bit of experience */
/* Using AND() is appropriate here */
AND(
/* This is common to both checks, so we can factor this out */
First_Response_Time__c != NULL,
OR(
IsClosed = TRUE,
NOT(ISPICKVAL(Reason_for_Reopen__c, 'AUTO REPLY EML')),
)
),
'FCR Met',
'FCR Not Met'
)
1: What you have is effectively (X && Y) || (X && Z)
. Using the property of distributivity of AND and OR, you can pull out the common part, the X
. So the expression becomes X && (Y || Z)
, which using AND()
and OR()
functions becomes AND(X, OR(Y, Z))