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
nelle3223nelle3223 

Validation Rule with picklists

I am trying to create a rule that if the activity Type is Bid Defense, Virtual Meeting or Meeting then the TA checkboxes must be filled in.  Here is what i have so far but says missing a "(".  if you can take a look that would be great.

IF(
(ISPICKVAL(Type, 'Meeting'), ISPICKVAL(Type, 'Bid Defense')) && ISPICKVAL(Type, 'Virtual Meeting'), NOT( Analgesia__c ),NOT( Infectious_Disease__c ), NOT( Canada_Phase_1__c ), NOT( Neurology__c ), NOT( Cardiovascular__c ), NOT( Oncology__c ), NOT( Dermatology__c ), NOT( Ophthalmology__c ), NOT( Endocrinology__c ), NOT( Psychiatry__c ), NOT( Gastroenterology_Hepatology__c ), NOT( Respiratory__c ), NOT( Hematology__c ), NOT( Women_s_Health__c ), NOT( Immunology_Inflammation__c ), NOT( Other__c )
))
James WooleyJames Wooley
So are you saying that if type is any one of those three values, all the checkboxes you listed must be checked? If so I think you need the following:
AND(
        OR(
              ISPICKVAL(Type, 'Meeting'),
              ISPICKVAL(Type, 'Bid Defense'),
              ISPICKVAL(Type, 'Virtual Meeting')
        ),
        OR(
              NOT( Analgesia__c ),
              NOT( Infectious_Disease__c ),
              NOT( Canada_Phase_1__c ),
              NOT( Neurology__c ),
              NOT( Cardiovascular__c ),
              NOT( Oncology__c ),
              NOT( Dermatology__c ),
              NOT( Ophthalmology__c ),
              NOT( Endocrinology__c ),
              NOT( Psychiatry__c ),
              NOT( Gastroenterology_Hepatology__c ),
              NOT( Respiratory__c ),
              NOT( Hematology__c )
        )
)

This will throw an error if the type is one of the three values you listed, and any one of the checkboxes is not true.
James WooleyJames Wooley
Apologies, my code cut off the last three options.
AND(
        OR(
              ISPICKVAL(Type, 'Meeting'),
              ISPICKVAL(Type, 'Bid Defense'),
              ISPICKVAL(Type, 'Virtual Meeting')
        ),
        OR(
              NOT( Analgesia__c ),
              NOT( Infectious_Disease__c ),
              NOT( Canada_Phase_1__c ),
              NOT( Neurology__c ),
              NOT( Cardiovascular__c ),
              NOT( Oncology__c ),
              NOT( Dermatology__c ),
              NOT( Ophthalmology__c ),
              NOT( Endocrinology__c ),
              NOT( Psychiatry__c ),
              NOT( Gastroenterology_Hepatology__c ),
              NOT( Respiratory__c ),
              NOT( Hematology__c ),
              NOT( Women_s_Health__c ), 
              NOT( Immunology_Inflammation__c ), 
              NOT( Other__c )
        )
)
Oscar Alejandro Garcia BenitezOscar Alejandro Garcia Benitez
You most have a bracket, a bracket closing. 
Oscar Alejandro Garcia BenitezOscar Alejandro Garcia Benitez
I would try with this.

IF(
(ISPICKVAL(Type, 'Meeting'), ISPICKVAL(Type, 'Bid Defense')) && (ISPICKVAL(Type, 'Virtual Meeting'), NOT( Analgesia__c ),NOT( Infectious_Disease__c ), NOT( Canada_Phase_1__c ), NOT( Neurology__c ), NOT( Cardiovascular__c ), NOT( Oncology__c ), NOT( Dermatology__c ), NOT( Ophthalmology__c ), NOT( Endocrinology__c ), NOT( Psychiatry__c ), NOT( Gastroenterology_Hepatology__c ), NOT( Respiratory__c ), NOT( Hematology__c ), NOT( Women_s_Health__c ), NOT( Immunology_Inflammation__c ), NOT( Other__c )
))

 
nelle3223nelle3223
The ones above did not work because only one checkbox needs to be checked and for the one above there is an error of ")" missing.
James WooleyJames Wooley
Making this work so that the error only fires if none of the checkboxes are ticked is a bit more difficult. Try something like:
AND(
        OR(
              ISPICKVAL(Type, 'Meeting'),
              ISPICKVAL(Type, 'Bid Defense'),
              ISPICKVAL(Type, 'Virtual Meeting')
        ),
        IF(Analgesia__c, 1, 0) +
        IF(Infectious_Disease__c, 1, 0) +
        IF(Canada_Phase_1__c, 1, 0) +
        IF(Neurology__c, 1, 0) +
        IF(Cardiovascular__c, 1, 0) +
        IF(Dermatology__c, 1, 0) +
        IF(Ophthalmology__c, 1, 0) +
        IF(Endocrinology__c, 1, 0) +
        IF(Psychiatry__c, 1, 0) +
        IF(Gastroenterology_Hepatology__c, 1, 0) +
        IF(Respiratory__c, 1, 0) +
        IF(Hematology__c, 1, 0) +
        IF(Women_s_Health__c, 1, 0) +
        IF(Immunology_Inflammation__c, 1, 0) +
        IF(Other__c, 1, 0) < 1
)

This should count up how many of the checkboxes have been checked and if the total is less than 1 (i.e. none have been checked), throw an error.
nelle3223nelle3223
I believe this has worked, thanks!
James WooleyJames Wooley
That's great nelle3223. Could you mark your question as solved so that others know you were able to solve your issue?