addError() Method in Salesforce Apex

addError() Method in Salesforce Apex

We create validation rules in Salesforce to show errors on the record detail page. When a user enters incorrect data, the validation rule stops the save and displays an error message. But when working with Apex, sometimes validation rules are not enough. For example, we need to use Apex code to check complex conditions or … Read more >>>

Add Days to Date Using Salesforce Formula

How to add Day to Date in Salesforce Example

I was working as a system admin for a company that uses Salesforce to handle customer support cases. Every time a new case is created, the support team must follow up within 3 days after the case is created. Instead of manually calculating the follow-up date, we can create a formula field in Salesforce that … Read more >>>

50 Salesforce Developer Interview Questions and Answers

50 Salesforce Developer Interview Questions and Answers

Salesforce developers play a crucial role in enhancing the capabilities of the world’s leading customer relationship management platform. With the demand for skilled Salesforce developers continuing to rise, candidates must prepare to face various interview questions that test their technical expertise and problem-solving abilities. Understanding common interview questions and their answers can give candidates a … Read more >>>

How to Truncate String in Salesforce Apex

Truncate a string in Salesforce apex

Recently, I managed an email marketing campaign in our Salesforce org, and the marketing team uploaded email subject lines to Salesforce. However, to ensure consistency and avoid any issues with storage limits or formatting when sending emails, I need to truncate subject lines longer than 80 characters. In this Salesforce tutorial, you will learn how … Read more >>>

How to Activate or Deactivate User From Salesforce Apex

Deactivate User Using Apex Class in Salesforce

The organization where I work as a Salesforce developer decided to upgrade a system according to Salesforce’s new update. During the upgrade, they wanted to deactivate users with specific profiles to ensure data security. I was assigned the task of deactivating all users with a particular profile. Here, I will explain how to activate or … Read more >>>

Convert a String to Decimal in Salesforce Apex

Salesforce apex Convert string to decimal list

While working as a Salesforce developer, I recently fixed an issue related to the input product pricing field data type. In the Salesforce application, there was a lightning component where the user could enter the product price, and by default, the input field was a string. To perform calculations with the entered value, such as … Read more >>>

Convert String to Boolean in Salesforce Apex

Convert String to Boolean in Salesforce Apex

Recently, I fixed a bug in a custom Salesforce Application where users had the option to turn off/on notifications. The preferences are stored as strings in a custom field on a User_Preference__c object. The possible values for this field are “true” or “false.” I had to convert these string values to Boolean values for the … Read more >>>

Reset and Change User Password Using Salesforce Apex

How to Reset Current User Password From Salesforce Apex

A Salesforce Developer team was developing a Salesforce application that required the ability to reset and change user passwords programmatically. To do this, I created an Apex class. Here, I will explain how to reset and change user password using Salesforce Apex. Reset Current User Password Using Salesforce Apex In the following Apex program, I explain … Read more >>>

How to Split String Method in Salesforce Apex

String Split by dot in Salesforce apex

While working as a Salesforce developer, I developed a feature that allows users to enter multiple email addresses separated by commas into a custom field. There, I had to extract and validate each email address individually. To separate the emails, I have used the split() function to extract the emails from the string field. In … Read more >>>

Convert String to Date in Salesforce Apex

Salesforce apex convert string to date

In a recent Salesforce development task, I worked on a Salesforce application that required me to collect customer information through a web form. One of the fields in this form is the customer’s preferred appointment date, which is submitted as a string. I had to convert the string to the date data type to save … Read more >>>