How to get Sandbox name using Apex?
When a Salesforce Sandbox is created or refreshed, the username will be appended with the Sandbox Name. So, we can use UserInfo.getUserName() and find the sandbox name from the User's ....
When a Salesforce Sandbox is created or refreshed, the username will be appended with the Sandbox Name. So, we can use UserInfo.getUserName() and find the sandbox name from the User's ....
Option 1: Sample SOQL: SELECT Id, IsSandbox, Name FROM Organization LIMIT 1 If IsSandbox is true, then it is Sandbox else it is Production. Option 2: Sample Apex Class: public ....
Sample Class: public class LeadCreation { public Lead objLead; public String lastName; public LeadCreation() { } ....
Achieving 100% Apex Test Coverage: A Step-by-Step Guide to Covering Catch Blocks in Salesforce As a Salesforce Developer, you know the mantra: Test your code. While aiming for the minimum ....
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 ) ....
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 ....