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
Kylee A.Kylee A. 

Record Type (id or name) not registering in validation rule on Case

Hello there! 
I have created two validation rules on case to require users to complete specific fields upon closing the case. All teams are required to complete the description except one. So, I created two rules. One for the individual team and one for everyone else.

RULE 1 - Here's the formula for (mostly) everyone:
OR(
ISPICKVAL(Type, ""),
INCLUDES(Reason__c, ""),
ISBLANK(Description),
ISPICKVAL(Resolution__c, "")
)
&&
OR(
ISPICKVAL ( Status , "Closed"),
ISPICKVAL ( Status , "Closed - Auto")
)
&&
NOT( RecordType.DeveloperName = "Credit Department")
Error message: Type, Reason, Description, and Resolution fields are required upon case close.

RULE 2 - Here's the formula for Credit Dept.:
OR(
ISPICKVAL(Type, ""),
INCLUDES(Reason__c, ""),
ISPICKVAL(Resolution__c, "")
)
&&
OR(
ISPICKVAL ( Status , "Closed"),
ISPICKVAL ( Status , "Closed - Auto")
)
&&
(RecordType.DeveloperName = "Credit Department")
Error Message: Type, Reason, and Resolution fields are required upon case close.

When I test to close a Credit Department case without reason description, it gives me the error message from the first rule. I have also tried this by using "RecordType.id = long 18 digit id" instead of name

Please advise.
SS
Record Type Label is label, you need to use Record Type Name which should be something like Credit_Department.
RecordType.DeveloperName = "Credit_Department"
SS
Credit Department is label you need to use Record Type Name which should be something like Credit_Department.
RecordType.DeveloperName = "Credit_Department"
AnkaiahAnkaiah (Salesforce Developers) 
Hi Shivani,

If you want to check with recordtype label name you need to modify like below.
 
OR(
ISBLANK(Type),
ISBLANK(Reason__c),
ISBLANK(Resolution__c)
)
&&
OR(
ISPICKVAL ( Status , "Closed"),
ISPICKVAL ( Status , "Closed - Auto")
)
&&
(RecordType.Name = "Credit Department")

If this helps, Please mark it as best answer.

Thanks!!​​​​​​​

 
SS
Hi Ankaiah, question is asked by Kylee. 
Kylee A.Kylee A.
Thank you for both of your responses! I thought I already tried those as well, but I will test them and let you know if they work. I appreciate it!
Kylee A.Kylee A.
I have tried it with both the RecordType.DeveloperName formatted with underscores as well as RecordType.Name without underscores and each time I was able to close a case with the missing required fields and no error message was shown.