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
netTrekker_ADnetTrekker_AD 

Task VR: If Completed Task Type then 6 fields are required

OR(ISPICKVAL(Task_Type__c, "Onsite"), ISPICKVAL( Task_Type__c , "Webinar"), ISPICKVAL(Task_Type__c, "Online")) && ISPICKVAL(Status, "Completed") && ISBLANK( PD_Expense__c ) && ISBLANK( PD_Completed_date__c ) && ISBLANK( No_of_Participants__c ) && ISBLANK( PD_Confirmation_Emailed__c ) && ISBLANK( Material_Shipped_on__c ) && ISBLANK( PD_Evaluation_Emailed__c ) )

 I am trying to create a task validation rule that requires 6 custom fields to not be blank if a custom field called Task Type is one of three picklist values AND the status of the task is Completed.

 

Above is what I have, but what it is doing is if the task type is one of the three and completed, it is only requiring one of the 6 fields to not be blank and then it is saving successfully.

 

What am I doing wrong??

Best Answer chosen by Admin (Salesforce Developers) 
flewellsflewells

It sounds like you want the rule to fire until all the fields are filled out.  In that case, you want to change your ANDs (&&) between the checkbox fields to ORs (||).  I think it would be something like this.

 

 

(OR(ISPICKVAL(Task_Type__c, "Onsite"), ISPICKVAL( Task_Type__c , Webinar"), ISPICKVAL(Task_Type__c, "Online")) && ISPICKVAL(Status, "Completed")) && (ISBLANK( PD_Expense__c ) || ISBLANK( PD_Completed_date__c ) || ISBLANK( No_of_Participants__c ) || ISBLANK( PD_Confirmation_Emailed__c ) || ISBLANK( Material_Shipped_on__c ) || ISBLANK( PD_Evaluation_Emailed__c ) )

 

 

 

All Answers

flewellsflewells

It sounds like you want the rule to fire until all the fields are filled out.  In that case, you want to change your ANDs (&&) between the checkbox fields to ORs (||).  I think it would be something like this.

 

 

(OR(ISPICKVAL(Task_Type__c, "Onsite"), ISPICKVAL( Task_Type__c , Webinar"), ISPICKVAL(Task_Type__c, "Online")) && ISPICKVAL(Status, "Completed")) && (ISBLANK( PD_Expense__c ) || ISBLANK( PD_Completed_date__c ) || ISBLANK( No_of_Participants__c ) || ISBLANK( PD_Confirmation_Emailed__c ) || ISBLANK( Material_Shipped_on__c ) || ISBLANK( PD_Evaluation_Emailed__c ) )

 

 

 

This was selected as the best answer
netTrekker_ADnetTrekker_AD

I see. So now it looks at each of the fields and throws an error if any of them are blank, whereas my old rule was just looking for one of them to NOT be blank.

 

Thanks!