Apex Code can feel very rigid once it’s in production. If you want to change any logic inside a class, you’ll need to go through an entire sandbox-to-release cycle – even if the changes are minor. Continue reading “Making Apex More Dynamic”
Category: Apex
Learn What External Credentials Mean for You and Your Salesforce Org
Are you an admin or developer who’s recently created a Named Credential, and clicked New instead of New Legacy and felt a bit confused about the difference? Read on. Continue reading “Learn What External Credentials Mean for You and Your Salesforce Org”
Exporting CSV Data Via Dataweave in Apex
Have you ever tried to handcraft CSV in Apex? It isn’t ideal and usually ends up as one big long concatenated list of field names appended to an unbelievably long string: Continue reading “Exporting CSV Data Via Dataweave in Apex”
GitHub Copilot
To my surprise, GitHub Copilot is an astonishingly good tool for developers. In this post, we will look at some AI history and context, then get into some example interactions of coding with Copilot.
Maps in Flow
Maps are a fundamental data structure in Apex and other programming languages. They allow us to store a series of key/value pairs, and then efficiently use a key to look up a value from the store. There is no built-in map construct in Flow, but it would be useful if there were. So, I built one!
Common Apex Mistakes – Too many SOQL queries
As a Salesforce developer seeing the message “System.LimitException: Too many SOQL queries: 101” can be very frustrating.
In a large codebase it can be time consuming to find and fix these kind of errors. Even when your code is bulkified – why do errors remain?
They may only occur intermittently under certain circumstances, but none the less they still happen.
Continue reading “Common Apex Mistakes – Too many SOQL queries”
Flow for Developers
Rivers, and paddling them in a canoe, can teach you important lessons about going with the flow. You’re never going to successfully paddle upstream against the Yukon (trust me – I’ve been there). Poor communication with a tandem canoe partner can make you both end up swimming. If you get pinned sideways, you must lean in to the obstacle.
The most important lesson, though, is the first one: Go with the flow. Let the river guide you. Work together to get the boat where it needs to be. All that power, blended with a bit of control, can have beautiful results.
From Draft to Finished in Apex
Paul Gardner said “A painting is never finished. It simply stops in interesting places”.
This is 100% true of code. The finish is not the most important thing – when we seek to learn by looking at code, the steps along the way say much more than the end-product alone.
So, as I created a self-contained piece of Apex for a project, I thought that I would git-commit every step. I don’t claim that this code is perfect, but I hope that, by showing my working, it might stimulate thought/discussion. It certainly made me think about the reasons for each step, from draft to finish, more than I otherwise would have.
Clean Code – Code versus Comments
As developers we have a responsibility to ensure that any code we write can be easily understood. Especially by any other developer who may come along and take on our code. Not only that, but writing code in such a way that when we ourselves come back to it, we can still recall what it does and why it does it.
List Processing in Apex with map(), filter(), and more
Salesforce developers can hardly have avoided JavaScript in the past few years. And, if you’ve used JavaScript, you may have used their tidy methods for handling arrays.
Continue reading “List Processing in Apex with map(), filter(), and more”
Using Lazy Evaluation to Write Salesforce Apex Code Without For-Loops
Functions or for-loops?
A developer working in Javascript has access to some really convenient functions on Arrays. Functions like filter() and map() can avoid the need to write for-loops. Is this actually a good thing? Can we write Apex this way?
Continue reading “Using Lazy Evaluation to Write Salesforce Apex Code Without For-Loops”
SObjectIndex – The Class You Can Use Everywhere
There is one Apex class in our Nebula library that we use more than any other: SObjectIndex. It is a generalisation of something that will be familiar to most Apex programmers: a Map of Ids to SObjects.
Continue reading “SObjectIndex – The Class You Can Use Everywhere”