Skip to main content

Posts

Showing posts with the label salesfoce

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

Trigger to check duplicates in salesforce using "from date" and "to date"

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

Efficient Data Table Pagination in Apex and Visualforce Pages

 Introduction: When dealing with large sets of data in Salesforce, it's essential to implement efficient pagination techniques to enhance user experience and optimize performance. One popular approach is using a data table with pagination in combination with Apex and Visualforce pages. In this blog post, we will explore how to implement a data table with pagination in Apex and Visualforce, enabling users to navigate through data seamlessly. Let's dive in and discover the steps to achieve efficient data table pagination in Salesforce. 1. Designing the Visualforce Page: - Create a Visualforce page that includes a data table component and pagination controls. - Define the columns to display in the data table and structure the page layout accordingly. - Incorporate CSS styles for an appealing and user-friendly interface. 2. Retrieving Data with Apex: - Develop an Apex controller or extension class to handle data retrieval from the Salesforce database. - Implement query logic to fet...

Efficient Test Data Generation with the Test Data Factory Class in Salesforce

 Introduction: When writing unit tests in Salesforce, having reliable and relevant test data is crucial for comprehensive testing and accurate validation of your code. The Test Data Factory class provides a powerful solution for generating test data in a structured and efficient manner. In this blog post, we will explore the concept of a Test Data Factory class and discuss how it can simplify and streamline your unit testing process in Salesforce. Let's get started! What is a Test Data Factory Class? A Test Data Factory class is a utility class designed to generate test data programmatically. It encapsulates the logic for creating test records, setting field values, and establishing relationships between objects. The Test Data Factory class acts as a centralized hub for generating consistent and reusable test data across multiple test classes. Benefits of Using a Test Data Factory Class: 1. Standardized Data Generation: The Test Data Factory class ensures consistent and standardize...