Identify Production / Sandbox Salesforce Org in Apex

In order to write reusable code and not hardcode in Apex there are times you will need to know if you are working in a Sandbox or Production org. Most of the time it would be to change variables such as knowing when to use a dev named credential vs a production named credential (hopefully […]

Tasks in UI aren’t Querying correctly

If you have tried to query a Salesforce Task that you can see in the UI but can’t query via Developer Console or Visual Studio Code. More than likely you are trying to query an archived Task. Don’t worry I have done this many times and keep forgetting about it. Luckily there still is a […]

How to Reduce Apex Heap Size Errors

If you are receiving this error: ‘Apex heap size too large’ it can be difficult to get rid of. Often neglected Heap refers to the amount of memory the transaction is using. If you have to query many objects / records and put them into a list you may run into this issue, especially if […]

How to find an Object Child Relationship Name

Salesforce SOQL doesn’t have traditional joins, instead, there are 2 different types of relationship queries: Parent-to-Child and Child-to-Parent. Child-to-Parent SOQL queries is Salesforce’s way to join a list of child-related records with a parent record. In order to obtain the list of child records and their data the SOQL query must look something similar to: […]

Monitor Platform Event Limits – Platform Event Tracker

Trying to identify the current org limit for platform events can be cumbersome. Tracking platform event usage limits is even more difficult. The usage limit is a rolling 24 hour limit based on the number of purchased platform events your org has. If it is the out of the box limit then it is 50k […]

Benefits of Creating a Generic Platform Event

Platform Events are a very useful feature within Salesforce. As the underlining technology to be able to use event-driven architecture, platform events within Salesforce provide near real-time event messaging which can be used internally and externally. Platform Events like other SObjects are pretty flat, the structure is an object with key-value pairs. In most scenarios […]

Reducing APEX Transaction Governor Limits with the Singleton Pattern

There are many best practices to adhere to when writing APEX. One of them around governor limits is to reduce the number of SOQL queries within the APEX code. A very common way to reduce queries and not to hit the dreaded: System.LimitException: Too many SOQL queries: 101 error is to use the singleton pattern. This […]

Accessing Salesforce with JWT OAuth Flow

Salesforce JWT OAuth flow allows the ability for one server to communicate with another server without the need for any user credentials. This flow is one of several other OAuth flows designed for accessing Salesforce through other applications. This article won’t be going through JWT tokens the structure and how they are created (this is […]

Schedule Recurring Apex Every X Minutes

Using the Schedulable interface gives you the ability to schedule a batch, class, queueable, etc. The interface is called with the System.schedule() method taking in 3 parameters a String for the job name, a String for a cron expression, and an Object of a schedulable class. This provides the ability for flexibility, to schedule through […]