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
pranavshahpranavshah 

To Avoid reusing of Custom Date field in one object

i need one solution on one of my app which i have created,

I have two custom fields, From_Date__c & To_Date__c on(Annual Leave object) , if suppose one user has applied a leave on that date field , the record will get save,, suppose if the same user tries to apply some another leave on same date it should throw some error like leave is already applied on the date.t .how it can be done..

How it can be solved..

Regards
Pranav Shah
YogeshMoreYogeshMore
Hi Pranav,

You can achieve this by Salesforce Standard feature called as Duplicate Rules. 

Goto Setup->Data Management->Duplicate Management-->Duplicate Rules.

Create duplicate rule and matching rule and activate the both.
In the duplicate rule you have to make the combination of userId and date, Because this rule should work by user wise.


Please mark this answer as SOLVED and BEST ANSWER if it helps you.

Regards,
Yogesh More
Salesforce consultant || Salesforce Developer
more.yogesh422@gmail.com || yogeshsfdc11@gmail.com
www.yogeshmore.com || Skype:-yogesh.more44