Record Types & Page Layout Strategy 💬 In plain words: Record Types let one object act like different forms for different teams. Different picklist values, page layouts, and processes — same Account object. Use them for truly different business processes. Not for cosmetic layout changes. 📌 Example: One Account object, two businesses: 'Retail Customer' record type shows B2C picklist values and layout. 'Enterprise Client' shows contract fields and a different sales process. Same table, two costumes. 🧠One object, many costumes: A Record Type is a costume on the same object — different picklists and layouts, same table underneath. Concept Record Types split one object into business variants. • Each type can carry its own subset of picklist values, its own business process — Lead, Case and Opportunity stages — and its own page layout per profile. • Lightning has changed the calculus. Dynamic Forms and conditional comp...
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. |