Apex Archives

Batch Class

Author - Webner
|
0 Comments
|

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 platform limits Read more…

How to get Salesforce Custom Field Ids in Apex

Author - Webner
|
0 Comments
|

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 CustomObject Where DeveloperName = \” + objectDevName + ‘\”).records;
Map customFieldIds = new Map Read more…

How to get Salesforce object records with only required fields in Apex

Author - Webner
|
0 Comments
|

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 = objectDetails.fields.getMap();
for(String fieldName : fieldsMap Read more…

Convert Set data into String

Author - Webner
|
0 Comments
|

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 a string we can use these two Read more…

Delete and deploy components from production using workbench

Author - Webner
|
0 Comments
|

How to delete and deploy components (Apex classes, Flows, Objects, etc) from production using workbench?

We cannot delete Apex classes directly from the Production org. Also, it is not possible to deploy deleted apex classes using Changeset. So, to delete them we can use these tools – Workbench, IDE Read more…

Create Post Install Script in SalesForce

Author - Harinder Jakhar

How to create Post Install Script in SalesForce

Definition
A post install script is an Apex class which is executed when a package is installed or upgraded. This class implements the InstallHandler interface. This interface has a method named as onInstall which specifies what Read more…