Skip to main content

Posts

Showing posts with the label CSV

Latest Post

Custom Metadata Types vs Custom Settings vs Custom Labels

  Custom Metadata Types vs Custom Settings vs Custom Labels 💬 In plain words:  Three lookalikes: Custom Metadata = configuration that DEPLOYS with your code (best for app settings). Custom Settings = org/user-specific values, changeable at runtime (hierarchy type is great for bypass switches). Custom Labels = translatable text for the UI. 📌 Example:  API endpoint URLs per environment → Custom Metadata (deploys with code, sandbox vs prod values). A 'Bypass_Automation__c' checkbox an admin flips during data load → hierarchy Custom Setting. The word 'Submit' translated to Hindi → Custom Label. 🎬 Real-Life Example: The Fee Table Trapped Inside Code  Skyline charges a different delivery fee per city. Apex needs those rates on every booking. The Old/Bad Way:  if (city == 'Delhi') fee = 50. Else if (city == 'Mumbai') fee = 65. … Every rate change is a code change, a test run, and a deployment. Why this is bad:  Business data is trappe...

Generating CSV in Lightning Web Components (LWC) - A Step-by-Step Guide

Introduction: Lightning Web Components (LWC) is a powerful framework provided by Salesforce for building modern and efficient user interfaces in the Lightning Experience. In this blog, we will explore how to create a full-fledged LWC application that generates and exports data as a CSV (Comma-Separated Values) file. CSV files are commonly used for data exchange and can be opened and manipulated with various spreadsheet software.

Create object, fields CSV file in salesforce using apex

 Below is sample code to to get all object and their fields in CSV using apex in salesforce. In this sample code we are getting objects using namespace and making CSV file. pubLIC class ObjectFieldsinReport{     public void makecsvwithobjectandfield(){         map<string, SObjectType> objs = schema.getGlobalDescribe();         string header = 'Object Name, Field, Label \n';         string finalstr = header ;         for(string key: objs.keySet()){             //if condtion to handle namespace objects //remove this  key.startsWithIgnoreCase('Your objects namespace') if you want to use all objects             if(key.startsWithIgnoreCase('Your objects namespace') && key.endsWithIgnoreCase('__c')){                 map<string, string> fieldList = new map<string, string>...

Uploading CSV and Creating Records: LWC Code Examples

Introduction: In this blog post, we will explore how to upload a CSV file and create records using Lightning Web Components (LWC). CSV (Comma-Separated Values) files are a popular format for exchanging data, and integrating the ability to upload and process CSV files can be valuable in various applications. We'll walk through the steps and provide code examples to help you implement this functionality in your LWC component.

LWC Full Dynamic Working Code for Generating CSV in Salesforce

Introduction: In this blog post, we will explore how to generate a CSV file dynamically using Lightning Web Components (LWC) in Salesforce. CSV (Comma Separated Values) is a commonly used file format for exchanging data between systems. By leveraging the power of LWC, we can create a flexible and user-friendly solution to generate CSV files on-demand within our Salesforce org.

Export Data to CSV Using Lightning Aura with Code Examples

Introduction: In Salesforce development, exporting data to a CSV (Comma Separated Values) file is a common requirement. It allows users to extract data from their Salesforce org and analyze it in various external tools like Excel or other data analysis software. In this blog post, we will explore how to export data to a CSV file using Lightning Aura, the user interface framework in Salesforce, and provide you with code examples to get started. Prerequisites: Before we dive into the code examples, make sure you have the following prerequisites in place: Salesforce Developer Account or Sandbox Basic knowledge of Lightning Aura components and Apex Step 1: Set up the Aura Component First, we need to create an Aura component that will serve as the user interface for triggering the data export process. Below is an example of a basic Aura component that includes a button to initiate the export. <!-- ExportDataToCSV.cmp --> <aura:component>     <lightning:but...

Read CSV and Insert CSV Records using visualforce page and apex class

Here is sample code to upload CSV file and insert CSV data in salesforce objects. Read CSV and insert CSV records in salesforce In this Code we are inserting data in contact object using standard template. First Column of CSV is Name, second column is LastName and third one is Title. Visualforce Page <apex:page controller="ReadandInsertController">     <apex:form >         <apex:pagemessages />         <apex:pageBlock >             <apex:actionRegion >

Popular Posts

Salesforce LWC Code for Multi-Select Lookup

Introduction: In Salesforce Lightning Web Components (LWC), implementing a multi-select lookup field can enhance the user experience and provide greater flexibility for selecting multiple related records. In this blog post, we will walk through the process of creating a multi-select lookup field using LWC. We will cover the required code snippets and provide step-by-step instructions to help you implement this functionality in your Salesforce org.