Skip to main content

Posts

Showing posts with the label object

Latest Post

How to Set Up Two-Factor Time-Based One-Time Password (TOTP) Authentication on iPhone Without Third-Party Apps

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:

Access members using Json Object in Apex Salesforce

 In Apex, if you deserialize JSON data into an object, you can access its members using dot notation or square bracket notation, just like accessing any other object's properties. Here's an example of how to do it: Let's say you have the following JSON data representing an object with members: String jsonData = '{"name": "John", "age": 30}'; You can deserialize it into an object like this: // Define a class to represent the structure of the JSON object public class Person {     public String name;     public Integer age; } // Deserialize the JSON into the Person object Person personObject = (Person)JSON.deserialize(jsonData, Person.class); Now you can access the members of the `personObject` using dot notation: String personName = personObject.name; // "John" Integer personAge = personObject.age;  // 30 Or, you can use square bracket notation to access the members: String personName = (String)personObjec...

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

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

SLDS Progress Bar

 SLDS progress bar is a graphical representation of progress. We can show the progress bar in many ways. Here we will do that thing in two ways. 1. By using a formula field 2. Directly use in Visualforce page or Component 1. By using a formula field: Create a percentage formula field in the object. You can use the mentioned formula for reference.            CASE(PicklistValue__c,'Draft',1,'Submit',2,'In Progress',3,'Approval                               Pending',4,'Approved',5,0)/5 Use your picklist field in place of   PicklistValue__c,   replace picklist values from yours, and assign an incremental number as mentioned above. We are doing this to get the percentage of progress. Now we will move to the next step to visualize that percentage on visualforce page.  visualforce page code/ Component Code:- <div class="slds-progress-bar" aria-valu...

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 >