How to write code for try catch in test class in Salesforce?
Sample Class: public class LeadCreation { public Lead objLead; public String lastName; public LeadCreation() { } ....
Sample Class: public class LeadCreation { public Lead objLead; public String lastName; public LeadCreation() { } ....
Sample Class: public class LeadCreation { public Lead objLead; public String lastName; public LeadCreation() { } public PageReference newLead() { objLead = new Lead(Company = 'Test', LastName = lastName, Status ....
System.schedule() method can be used to schedule a Schedulable class at specified time instantly in Salesforce. Check the following sample code for reference. Sample Code: AccountUpdateScheduler obj = new AccountUpdateScheduler(); ....
Upsert uses the sObject record's primary key (the ID), an idLookup field, or an external ID field to determine whether it should create a new record or update an existing ....
Using Pattern.matches() and RegEx, we can validate Phone Number or Mobile Number using Apex in Salesforce. In the following example, I have made sure the Account Phone number field contains ....
SOQL Injection can occur in Apex code whenever your application relies on end user input to construct a dynamic SOQL statement and you do not handle the input properly. To ....
Sample Code:List < Schema.SObjectType > gd = Schema.getGlobalDescribe().Values(); Map<String , Schema.SObjectType > globalDescription = Schema.getGlobalDescribe(); for ( Schema.SObjectType f : gd ) { Schema.sObjectType objType ....
We can query or we can use getInstance() to get the value and then we can use update DML Operation to update the Custom Settings value. Please check the following ....
To Set Up Test Data for an Entire Test Class in Salesforce, @testSetup is used. Sample Test Class: @isTest private class CommonTestSetup { /* Method to setup data */ ....
To set From Address for sending emails using Apex, you have to set Organization-Wide Email Address and use setOrgWideEmailAddressId. 1. Go to Email Administration --> Organization-Wide Addresses. 2. Click "Add" button. 3. ....