How to Generate the Random String using Apex in Salesforce

Salesforce Apex generate random 10 digit string

I recently worked on customer support cases in our Salesforce org. To manage case tracking and ensure each case has a unique identifier, we have to generate a random alphanumeric reference code for each new case. Customers will use this code to reference their case in communications. To solve this, I created an apex class … Read more >>>

How to Convert Unix Timestamp to DateTime using Apex in Salesforce

Convert UNIX time to Date time in Salesforce Apex

Our Salesforce org has an application that logs user login events, including a Unix timestamp indicating the exact time each login occurred. These logs are sent to the org to analyze user activity and track engagement over time. We had to convert the Unix timestamp for each login event into a DateTime format for reports … Read more >>>

How to Create SObject in Salesforce Apex

SObject in Salesforce

I created a custom logging feature to track changes to records in any object, such as an account, contact, or custom object. The method should accept the SObject type to work with any object in Salesforce. For that, we need to declare a SObject in Salesforce Apex. Here, I will explain what an SObject is … Read more >>>

Serialize and Deserialize Enums in JSON in Salesforce Apex

Serialize and deserailize Enum values in JSON in Salesforce Apex

In our Salesforce org, we were working on integrating our Salesforce instance with a third-party ticketing system for managing customer support cases. The goal was to sync the status of support cases between Salesforce and this external system using an API. We need to send the current case status to the third-party system via API. … Read more >>>

Schedule Jobs Using the Apex Scheduler in Salesforce

Schedule jobs via Apex Class in Salesforce

While working as a Salesforce developer, I was tasked with scheduling the weekly email for sales representatives. To do this, I used the Salesforce Apex Scheduler to schedule a job that runs weekly, retrieves the necessary data, and sends emails to sales representatives. In this Salesforce tutorial, I will explain the Salesforce Apex Scheduler and … Read more >>>

Extract Year, Month, and Day from a Date Field in Salesforce Apex

Extract day date and year from datetime in Salesforce Apex

While working as a Salesforce developer, I was assigned a task to build a custom logic that breaks down a date field into its individual components—year, month, and day. This was required so that we could generate customized reports and perform date-based filtering for opportunities. To solve this, I had to extract the year, month, … Read more >>>

Compare two Strings in Salesforce Apex

String comparison in Salesforce Apex

While working as a Salesforce developer, I was asked to validate the email domains of contacts before saving the records. To ensure that contacts belonging to specific companies are tagged or marked, such as when their email domain matches a predefined list of email domains. I used the equality operator “==” to compare the strings. In the steps … Read more >>>

How to Convert JSON to String in Salesforce Apex

Convert JSON to string using Parse in Salesforce Apex

As a Salesforce developer, I recently worked on integrating our Salesforce org with an e-commerce platform. The eCommerce service provides product details in JSON format via an API. To display these details in Salesforce, I need to convert the JSON response into a string for processing. In this Salesforce tutorial, I will explain the method … Read more >>>

How to Convert Date to String in Salesforce Apex

Salesforce convert date string in 'yyyy-mm-dd' format

While working as a Salesforce developer, I created a report that displayed the last activity date for each account. The LastActivityDate field in Salesforce is a Date type, but I wanted to display it as a formatted string, such as “October 1, 2024” in a custom email notification. To achieve this, I converted the Date to a … Read more >>>

Agentforce in Salesforce

DOWNLOAD FREE AGENTFORCE EBOOK

Start with AgentForce in Salesforce. Create your first agent and deploy to your Salesforce Org.

Salesforce flows complete guide

FREE SALESFORCE FLOW EBOOK

Learn how to work with flows in Salesforce with 5 different real time examples.