Test Class for Apex REST Callout

A Developer wants to implement a connection from Salesforce to a 3rd party API using Apex; A great method for retrieving external data is to implement a HTTP callout process using Apex. How can we run test class for callout ? As you may know, Apex Test Classes will not let us conduct a HTTP callout; therefore, it…

Salesforce Platform Cache & Partitions using Apex

Platform Cache Platform Cache is a memory layer that stores Salesforce session and org data for later access which improves the performance of your applications. Platform Cache improves performance by distributing cache space so that some applications or operations don’t steal capacity from others. Salesforce allow you to create partitions. Partitions allow you to distribute cache…

What is Dynamic Apex in Salesforce and how to use it ?

Dynamic apex enables developers to create more flexible applications by providing them with the ability to “Access sObject and field describe information”, “Write Dynamic SOQL Queries”, “Write Dynamic SOSL Queries” and “Dynamic DML”. It consists of several components such as schema describe, dynamic SOQL, dynamic SOSL, and dynamic DML. 1) Access sObject and field describe…

How to write test class for Batch Apex in Salesforce ?

We should always test batch class with good amount of data (minimum 200 records) in our test class. Here is the example of batch apex testing. In below code, we are updating name of all accounts with “Updated” keyword in the last of account name. Batch Class: global class AccountUpdate implements Database.Batchable { global Database.QueryLocator…

How do we write a Batch Class in APEX and schedule it to run?

Scenario We need to look at all Accounts and update the related Contacts description with Rating field from respective Account. e.g. “Account rating is Cold” Why Batch Apex ? Batch Apex is used to process high volume of records and it allows us to run their code on a specific time. In batch APEX there is the…

How can we handle Approval Process using APEX?

Approval process is an automated process which is used to submit, approve and reject records in Salesforce. It specifies the steps necessary for a record to be approved and who must approve it at each step. We can configure approval process from Salesforce, and then use APEX to submit, approve or reject the record. Automatic Submission of Record for Approval…