Unlocking an additional layer of safety to your iPhone is less difficult than you might suppose. With Two-Factor Time-Based One-Time Password (TOTP) authentication, you may bolster your device's protection and other website safety without relying on 1/3-party apps. Here's how you could set it up:
Here is the Sample code to prevent update and insert records between from date and end date in salesforce. This trigger have two events:-
before insert and before update
trigger Duplicatecheck on <Obejct> (before insert,before update) {
set<object > ListOfrecords= new set<object >([SELECT id,Valid_Form__c,Valid_To__c FROM <object>]);
for(<object> obj1 : ListOfrecords) {
for(<object> obj2: Trigger.new) {
if(obj2.VS_State__c== obj1.VS_State__c && obj2.vs_Tax_Type__c == obj1 .vs_Tax_Type__c){
if((obj2.Valid_To__c >= obj1.Valid_Form__c&& obj2.Valid_To__c <= obj1 .Valid_To__c ) ||
(obj2.Valid_Form__c>= obj1.Valid_Form__c&& obj2.Valid_To__c <= obj1 .Valid_To__c ) ||
(obj2.Valid_Form__c>= obj1.Valid_Form__c&& obj2.Valid_Form__c<= obj1 .Valid_To__c ) ||
(obj2.Valid_Form__c< obj1.Valid_To__c && obj2.Valid_To__c > obj1 .Valid_To__c )){
obj2.addError('record already exist between these dates.');
}
}
}
}
}
Output:-
Trigger to prevent insert or update duplicate records. |