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
Ti Saunders 8Ti Saunders 8 

Validation Rule - Required Fields Based on User Role

I'm trying to create a validation rule that makes fields specific required for certain users based on their roles. If a user's role is: Account Manager, Sales Rep, or International Sales, AND they are marking an opportunity stage (picklist) as "Closed - Won" we want to make a few fields required.

The fields we want to be required if the above is true are: 
ARR 
Total Opportunity Value (TCV)
Reason for Win 
Win Notes
Growth
Products Sold

In addition to the above, we also need the minimum characters for "Win Notes" and "Growth" to be 500 characters.

Any help is greatly appreciated.
Best Answer chosen by Ti Saunders 8
Karthikeyan Rajendran 14Karthikeyan Rajendran 14
Hi Ti Saunders 8

      To achieve this in Validation Rule you have to create 6 validation rules created for each fields to make it required. 

IF(AND((OR( $UserRole.Name = 'Account Manager',$UserRole.Name = 'Sales Rep',$UserRole.Name = 'International Sales')), ISPICKVAL(StageName, 'Closed - Won'),ISBLANK(YOUR FIELD)),TRUE,FALSE)

Replace YOUR FIELD with the above 6 fields. You can include the mandatory message and minimum character limit in same rule for Win notees and Growth.

Regards
Karthik