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
vikramkkvikramkk 

Public groups in validation rules

Hi

 

I created a validation rule which uses $UserRole.Name in its condition. But there are too many roles that I have to use in my validation rule.I have a public group which contains various roles. I want to use some thing like "$Group.Name" instead of  "$UserRole.Name".  Is that possible?

My validation rule is as folows.

 

AND(  ISBLANK( Date_of_Birth__c ) ,

OR(
$UserRole.Name = 'Operations',
$UserRole.Name = 'Sales Manager',
$UserRole.Name = 'Sales Agent',
$UserRole.Name = 'Outbound Agent',
$UserRole.Name = 'Outbound Manager',
$UserRole.Name = 'Support Manager',
$UserRole.Name = 'BlueDirect Support Rep',
$UserRole.Name = 'Agent',
$UserRole.Name = 'Manager',
$UserRole.Name = 'TX Agent',
$UserRole.Name = 'TX Manager')
)

 

Please let me know if there is any other to achieve this.

Shashikant SharmaShashikant Sharma

No you will not get public groups in validation rule , I would suggest you to write a trigger for this validation. If you have any issue in writting trigger I can help you in it.

vikramkkvikramkk

Can let me how I can create a trigger in such an instance?

 

Thanks

Vikram

skodisanaskodisana

Hi,

 

Use the Hierarchy Custom Setting. Load all the Roles and User's data.

You can use Hierarchy Custom Settings in validation rules.

Ex:

 

$Setup.ObjectName__c.FieldName__c 

 

Thanks,

Kodisana