Tag: Apex
Comparable Interface in Apex
When we have to sort a custom object list, based on a field, we try doing it by SOQL query ORDER BY but sometimes due to any constraint or some complex requirements we need to sort the list in Apex
Inheritance in Apex
Inheritance is a feature of OOPS that allows us to inherit the properties or methods of a class. The base class acts as a parent, the class that is inheriting is called the child class. The child class has access
Bulk State Transition
The Bulk State Design pattern is the general pattern that executes the bulk of the actions in Apex based on the change of state of one or more records. Bulk transitions increase the code reusability by allowing only records that
The RefreshApex Method and its implementation in the Lightning Web Component
The refreshApex() function is used when we want to refresh the page data in lightning web components. We can update the wire function or parameter data using refreshApex (), and then component values will be rendered. Refresh apex works only
Call Apex Function inside an LWC Function
While creating the LWC component whenever you want to call an apex function you use the @wire function in it and pass parameter in it which has @track or @api decorator attached with it like @track id; or @api id;
Batch Class
Batch class in salesforce is used to run large jobs (think thousands or millions of records!) that would exceed normal processing limits. Using Batch Apex, you can process records asynchronously in batches (hence the name, “Batch Apex”) to stay within
How to get Salesforce Custom Field Ids in Apex
We can get the Ids of Salesforce Object’s custom fields in the Apex code using Tooling API. Following is the example code for the same: String objectDevName = ‘ObjectName’; ToolingAPI toolingAPI = new ToolingAPI(); List objectData = (List)toolingAPI.query(‘Select Id From
How to get Salesforce object records with only required fields in Apex
Problem: If you want to get records with dynamic fields (all fields or only required fields) selection of an object in Salesforce. Solution: List normalFields = new List(); List requiredFields = new List(); Schema.DescribeSObjectResult objectDetails = ObjectName.sObjectType.getDescribe(); Map fieldsMap =
Convert Set data into String
Introduction When working with sets in apex sometimes we need to create a string from the set’s values but there is no function that can convert a set into a string as we have for lists. To convert set into