An Introduction to the Apex Programming Language: Capabilities & Use Cases

Clicks, Not Code

‘Clicks not code’ is a big part of Salesforce. As an #AwesomeAdmin there is a lot I can do to automate tasks for my users:

  • Create workflows to automatically fill in fields and send emails out based off of certain criteria
  • Develop processes to create new records or post to Chatter
  • Build flows with more complex criteria
  • And more!

But there is a lot I can’t do. That’s where code comes in. It takes Salesforce to the next level.

Delivering the Next Step with the Apex Programming Language

The code involved with Visualforce pages and Lightning components added to standard pages allow organizations to do more. For example, they can filter a related list or show a calculation from related items. To enhance the user experience to its full potential and deliver full automation, though, they turn to the Apex programming language.

Apex unlocks what the ‘clicks not code’ tools can’t. The programming language can reach across objects that aren’t directly related, perform batch processing, and calculate rollups on records that aren’t master-detail. It can perform logic on an object based on records of another object process records that are deleted (or undeleted) and integrate with outside systems.

Should You Invest in Leveraging the Apex Programming Language?

Code can automate your difficult multi-step processes, saving your users time and frustration. It can combine screens, pulling information from multiple objects into the same page, saving users from clicking back and forth. The code can execute when a button is clicked and be used in declarative tools like Process Builder. Therefore when a field changes, the process then tells the code to execute, or it can run on any record that is created (or edited or deleted) when using a tool like data loader or an integration that creates or updates records. You can even create small chunks of reusable code for the declarative tools to use them on any object. For example, you can lock a record from editing on any object when criteria changes.

Quite simply, if you want to truly customize your Salesforce platform, you’ve got to give the Apex programming language a shot. It won’t take long to prove it’s worth your invested time to learn it or hire a trusted resource.

Use Case 1: Event Management

I’ll share a simple example of automation, but know that the sky is the limit. This is just scratching the surface of the Apex programming language. At Soliant, I work with a lot of nonprofit organizations. Many of my clients host events and manage sales of tickets for these events. These tickets are often sold in chunks – 25 tickets come with the Gold Sponsorship package, 35 tickets come with the Platinum Sponsorship package, etc.

Often, when purchasing tickets, the buyer doesn’t supply the information of who will actually be attending. They wait until closer to the event to provide the names of their guests. Unfortunately, this means the nonprofit organization’s team must create 25 tickets every time the Gold Sponsorship package is purchased. This is obviously inefficient and not a great use of their time. By using the Apex programming language to generate those tickets automatically with a sponsorship purchase, I can help my clients improve their internal workflows and focus less on manual processes in Salesforce. The code creates the tickets under the purchaser account and allows the user to fill in the names of the attendees at their own pace. Nonprofit organizations can simply and efficiently see how many tickets they sell and who attends their events.

Use Case 2: Automatic Payment Calculations and Record Updates

My next example leverages Apex in the Salesforce Sales Cloud for automation calculations related to opportunity amounts and payments. (An opportunity amount refers to the estimated sale amount.)

Without the automation of Apex, many of my clients have found themselves manually dividing the opportunity amount up for payments on a variety of payment schedules (weekly, bi-weekly, monthly, etc.). They then must applying the payment to the oldest outstanding payment, again all manually.

However, through Apex, I can write code to calculate this for them over a specific time frame. It even can take custom variables into consideration, such as a down payment. The code can equally calculate out each payment to be made, and make the last payment the remainder of any leftover amount. When it is time to take a payment, the user simply clicks a button and enters the payment amount. The code finds the oldest payment due and applies the amount. If that line item is paid in full, the code marks it as such. The system can even record if it receives a partial payment or the full amount of a payment plus a credit toward the next payment.

Use Case 3: External System Integration

You can take the Apex programming language one step further and integrate your Salesforce solution with an outside payment processing system. If the external system returns the payment as approved, the code executes, and the payment line item is marked as paid. If payment is declined, then the line items remain as unpaid.

Of course, the users could be doing all of these calculations and record lookup manually. But with Apex customization, they only have to click a button and enter the payment amount, leaving them more time to focus on what is important, their clients.

It also saves the accounting team time. They don’t have to check that each payment is created correctly and is credited to the correct line item.

Make an Impact with Apex Across All Industries and Business Types

Apex code can automate processes across your Salesforce instance. It can create easy to use interfaces that make your users want to enter more data. It can integrate with external applications to make your Salesforce data more meaningful. Whether you use Sales Cloud, Service Cloud, or some other combination of clouds and functions, the Apex programming language can bring your Salesforce automation and business process to the next level.

Work with Apex Programming Language Experts

Are you looking for more insights or a development partner to help drive more innovation in your Salesforce solution? Our team has delivered more capabilities and stronger systems to hundreds of clients over the last decade, and we’d love to help you drive growth on the platform. Contact us today to learn more about our experience with the Apex programming language and to see if we’d make a good fit as your Salesforce development partner.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top