Skip to main content

Posts

Showing posts with the label Custom Code

Latest Post

Record Types & Page Layout Strategy

  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...

Efficiently Deleting Records in Salesforce with Dynamic Batch Processing Using Custom Metadata

Sometimes, there arises a need to delete records from an object in Salesforce. To address this requirement efficiently, we can utilize a batch class that handles the deletion process. This solution leverages the power of custom metadata types to pass the object information, offering flexibility and easy maintenance. By modifying the custom metadata records, instead of modifying the batch class itself, you can effortlessly manage the deletion process. In this blog post, we will explore an approach that enables you to delete records in a more dynamic and scalable manner, reducing manual effort and providing a robust solution for record deletion. Batch Class:- Global class DeleteRecords Implements Database.batchable<sobject>,database.stateful {     global string query;          global integer totalSizeRecords=0;          global Database.QueryLocator start(Database.BatchableContext BC){         Delet...

Field History Custom Component

 We have the standard history for our fields in salesforce. We can use that functionality from the related list. Here we will see that functionality using component and apex class. This will be a generic code for custom objects. Just paste the id of the record for which you want to see history. Make sure you have enabled history tracking for that object.  Here is the apex class for JSON. Save this first. HistoryWrapper.cls public class HistoryWrapper{     public WrapperClass_attributes attributes;     public String CreatedById;       public datetime CreatedDate;       public String Field;        public boolean IsDeleted;     public string NewValue;     public string OldValue;     public String Id;        public Wrapperclass_CreatedBy CreatedBy;     public static list<HistoryWrapper> parse(String json){         ret...