Posts

Showing posts from May, 2024

Salesforce Custom Metadata Types Explained: Benefits, Setup, and Examples

Image
Salesforce's powerful Custom Metadata Types functionality lets developers and administrators make deployable, adjustable configurations and settings. The application cache contains all of the custom metadata, allowing access without requiring repeated database queries. How to create Custom Metadata Type 1. Search  Custom Metadata Type  in Setup Quick Find. 2. Click New Custom Metadata Type 3. Fill all required fields and click save Accessing Custom Metadata Type in Apex 1. Using getAll() - returns map of developer name to metadata type record list.   Datatype returned by the method - Map<String, Games__mdt> List<Games__mdt> mcs = Games__mdt.getAll().values(); boolean textField = null; if (mcs[0].GameType__c == 'PC') { textField = true; } system.assertEquals(textField, true); 2. Using getInstance(recordId) Returns a single custom metadata type record sObject for a specified record ID. Games__mdt mc = Games__mdt.getInstance('m00000000000001'); Using g

Salesforce Custom Settings: Optimizing Your CRM for Maximum Efficiency

Image
What is Custom settings Salesforce Custom Settings is similar to custom objects, that allow you to create custom data sets and associate them with your Salesforce organisation. It store data in the application cache, enabling efficient access for various Salesforce functionalities like formula fields, validation rules, Apex, and SOAP API. Why we use Custom settings It allow to store configuration data including default settings for org, application parameters, or any other custom data that can be used in apex or LWC.   Unlike custom objects, they can be accessed without needing to perform SOQL queries, making them faster and more efficient for accessing configuration data. Types of Custom Settings 1.  List Custom Settings It provides a reusable set of static data that can be accessed across your organization, It  doesn’t vary with profile or user.  Examples of list data include three-letter country code abbreviations. 2. Hierarchy Custom Settings It uses a built-in hierarchical logic t

Salesforce GraphQL: Developer Insights

Image
What is GraphQL?   GraphQL is a standard query language for APIs and a runtime for fulfilling those queries with your data. It provides users with a single endpoint to request all necessary data from in a single request. Applications that utilise GraphQL APIs are frequently far more efficient than those that stick with REST APIs. This is due to their capacity to retrieve all required data in a single invocation, which reduces the number of round trips to the server, allowing you to customise it to meet your needs. Why GraphQL is better than REST API? REST API is the gold standard for APIs, yet traditional REST APIs present significant issues when developing modern, highly performant, and scalable online and mobile applications. REST endpoints do not allow client changes to the API endpoint's response.   For example, when fetching a user's phone number from a REST API, receiving extraneous data beyond the number adds unnecessary costs for both the server and the requester. "