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
Sonja R 5Sonja R 5 

What it the correct syntax for creating validation rule for 'Category__c' AND 'Problem__c' (required if RecordType.Name = "Complaint")

if record type = complaint, then categoy and problem cannot be blank
JLA.ovhJLA.ovh
AND(RecordType.Name = 'Complaint' , OR(ISBLANK(Category__c) , ISBLANK(Problem__c) ) )
Sonja R 5Sonja R 5
Thank you.  I get this synthax error with using your suggested formula.
Error: Field Category__c is a picklist field. Picklist fields are only supported in certain functions.
JLA.ovhJLA.ovh
You didn't mention that it was a Picklist. The formula could be :
AND(RecordType.Name = 'Complaint' , OR(ISBLANK(TEXT(Category__c)) , ISBLANK(Problem__c) ) )
Sonja R 5Sonja R 5
That worked..thanks!  Last question.  I selected to have the error message displayed at the field but when the expression is true, I recevie the following message on a new page.  I would like my error message to be displayed at the field level where the express is false 'If Case Type = Complaint, Category and Problem must be selected' ...but instead it is returning the error message below on a brand new page.

Upsert failed. First exception on row 0 with id 500d0000012aPuNAAU; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, If Case Type = Complaint, Category and Problem must be selected.: [Category__c]
Error is in expression '{!saveCase}' in component <apex:commandButton> in page newcase: Class.CaseEXT.SaveCase: line 131, column 1
An unexpected error has occurred. Your development organization has been notified.