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
LIM AI KHOONLIM AI KHOON 

Validation rules one ID can be used in different year

Hi,

I have one scenario, which is 1 staff id cannot be duplicated. in the same year. For example
Staf ID 123 Year__c = 2021 [Accepted]
Staf ID 123 Year__c = 2022 [Accepted]
Staf ID 123 Year__c = 2022 [Not Accepted because already exist in 2022]. May I know how to do that using the validation rule?
 
not(isblank(vlookup( $ObjectType.Incentive__c.Fields.Id, $ObjectType.Incentive__c.Fields.Name,Name))) &&
Id <> vlookup( $ObjectType.Incentive__c.Fields.Id,$ObjectType.Incentive__c.Fields.Name, Name)
This is my current formula, but this does not work like how to suppose to.
 
Best Answer chosen by LIM AI KHOON
LIM AI KHOONLIM AI KHOON
https://focusonforce.com/configuration/preventing-duplicate-records-with-salesforce-config/