Joys of Apex Interview: Empower Your Orgs with Apex Rollup

Share this article...

For those interested in or working with Apex Rollup, you may be interested in the Joys of Apex blog – the author, James Simone, is the developer behind the popular repository, Apex Rollup.

I interviewed James to find out how he came to be in the Salesforce world, the challenges he has faced, and what motivates him every day. We also take a look at the origins of Apex Rollup, as well as some interesting use cases, but first, let’s take a look at how James’ journey began.

Starting Out In the Salesforce Ecosystem

Atlas: Hi James, this has been a long time coming – ever since I found your blog, Joys of Apex, and after you joined the Salesforce Discord Exchange (SFXD). I finally have a chance to talk to you about all things Salesforce! So, how did you get started in the ecosystem?

James: Back in 2014, I met Jonathan Gillespie (Senior Software Engineer, Salesforce) at work – my company was looking to sunset a 20+ year old custom CRM by moving everyone into Salesforce. Shortly after I met Jonathan, I was told that I would be moving from my role in Finance to the burgeoning Tech team as a Product Owner. 

This was the beginning of a 3-year endeavor with some real highs and lows throughout the process, including:

  • The “data migration disaster”, during which Jonathan and I found out that the previous year’s worth of work by a colleague to transform the old system’s data into Salesforce-ready data had never been tested (and couldn’t possibly work!).
  • The “Black Friday org lockdown” – it’s the busiest sales day of the year and suddenly people couldn’t do their job.
  • The old classic: “We said we wanted X and you’ve delivered it, but what we really wanted was Y.”

Being a product owner in the face of these occurrences was challenging. I was working 14-hour days for months just trying to hold everything together – in hindsight, it’s easy to see how unsustainable that was. Suffice it to say, the stress level was high for members of my team.

It culminated with Jonathan and my other best developer both deciding to leave at the same time. Looking back, their moving on to other opportunities opened the door for me to succeed as a developer – Jonathan had already begun teaching me to code, and he and my friend advised my boss that I was ready to move into a more technical role.

By the end of 2016, I was given the opportunity with another company to move into a full-time development role. I eagerly applied the lessons I’d learned while working in my first org, and began laying the foundations for what would become the Joys of Apex blog – fast unit tests that worked by combining the power of mocking DML and SOQL calls to fully decouple the database from the methods under test.

Fast-forward a couple of years, and I had started my own consultancy – right before the pandemic hit in 2020. After finishing my first contract, though, and with the uncertainty of Covid looming in my mind, I made the decision to return to full time employment with the consultancy Jonathan was working for. He referred me there; a favor I soon returned, after being hired by Salesforce at the beginning of 2021. Though we haven’t seen each other in person since August 2016, I’m happy to say that Jonathan and I work together every day now, and I feel incredibly grateful to have come full circle!

Atlas: Isn’t it interesting how it all comes together? Okay, this question is something I love to ask, so here it goes: what do you wish you knew before starting out in Salesforce, and if you could go back in time, what would you say to yourself?

James: That’s a good question. Things I wish I knew when starting off… and this might surprise you, but I wish I’d known that soft skills are just as important as technical acumen. Salesforce is an enormously powerful and flexible CRM, but that comes at a cost; if requirements aren’t clear, or the why behind an ask isn’t understood to its fullest extent, solutions inevitably drift from their intended solution.

Learning when to say no, when to ask better questions, and how to fish for the actual problem, were things I lacked great depth in when starting out. As a developer, knowing how something will help and why it’s needed helps to hone in on the optimal solution; it also helps to expose edge cases prior to shipping something.

If I could go back in time, I would have encouraged myself to be more active in open source earlier in my career. I remember submitting an issue for a React component on GitHub in 2017, and at the time it was a nerve-wracking experience for me; I was afraid that the issue I was describing wasn’t real, and that by posting it I would be exposing myself as a fraud.

That’s another thing I would tell myself – the imposter syndrome never really goes away, so best to have those feelings of inadequacy and then move on! In the end, the only dumb questions are the ones that go unasked. Disassociating our egos from the code we produce leads to the best results.

Worrying about what somebody else will think – in terms of exposing our own blind spots – won’t get the job done, but asking the question might.

Living with Lockdowns

Atlas: I also wanted to ask how you coped with lockdowns during the pandemic? You are based in beautiful Colorado, so I’m sure going outdoors helped a lot. Any tips for ‘work-from-home’ folks like me? 

James: My wife and I had the benefit of having spent quite a bit of time cooped up in the past. We travelled for five months through the American West and Europe prior to moving to Colorado. Having previously spent every waking moment of every day together during that time has helped tremendously as we have endured the pandemic. 

We also, like many couples in Denver, chose to adopt a dog at the beginning of lockdown, and having a pup forced us both to be outside even when we might have otherwise been tempted to stay indoors. Colorado’s natural beauty is, of course, very inspirational, but I also took heart from an interview I saw between Jimmy Fallon and Trevor Noah very early on in the pandemic – Trevor Noah admitted that he wasn’t finding it that hard to stay inside.

Since we had to stay indoors for a greater quantity of time anyway, I reconnected with my friends, spent time writing the Joys of Apex, and in general tried to better myself. I won’t sugarcoat it though – it’s been a challenging time – I have no doubt of that. After we got vaccinated, I finally allowed myself to start rock climbing again, including getting a membership to a gym here in Denver. The ability to train for and endure strenuous movement while problem-solving (up a wall!) has probably done more for my mental health than anything else during these past few months.

Origins of Apex Rollup

Atlas: Now I’m sure people have heard about declarative rollup summaries (DLRS) by the great Andrew Fawcett. When I was starting out it was a lifesaver for me and still serves well on many orgs today. How did the idea of Apex Rollups come to be, and how would you describe it to admins and developers?

James: When I started at the consulting company that Jonathan was working for last year, one of the first problems they came to me with was record-locking due to DLRS. The admin there had been wrestling with their DLRS installation for a number of years, and was looking to uninstall the package. They had tried a number of different options – scheduled rollups, async rollups – in addition to synchronous ones, but they kept running into issues. There was an immediate need for rollups that didn’t cause issues, and I had a day to build something that would work without the need for maintenance.

That day planted the idea in my head; it was something I had already thought about more than once over the years – my first org had DLRS installed too, and we’d had a ton of issues with it in that org as well.

In addition, last year was also the year that you, Atlas, invited me to SFXD, the unofficial Salesforce community on Discord. Time and time again, I saw people looking for simple custom rollups; either they’d tried DLRS and found it too big or unwieldy for their org, or they were using some paid version with extreme limitations.

I was looking for a way to give back to the community that had taken me in. Although I had found happiness writing articles for the Joys Of Apex, I found myself wondering if there was some way to combine my newly rekindled interest in rollups with that interest in giving back.

I took the last two weeks of December 2020 off with the intention of having a functioning product by January 1st. I ended up getting everything up and running by January 4th, after some inevitable delays due to the holidays.

I’ve been blown away by the community response since launching Apex Rollup, and with several hundred installations in less than a year, it’s clear that there are a lot of people out there looking for a streamlined rollup solution. Working on Apex Rollup has also given me the chance to partner with several nonprofits – I’m very happy to see foundations embracing Apex Rollup as their custom rollup solution of choice.

Apex Rollup Use Cases

Atlas: Sounds fantastic. I want to dig deeper into the Apex Rollups. Playing around with it, I found that there are separate use cases, for example using it as an invocable action inside flows and one-off calculations, that you can invoke anytime. From what I understood, invocable action is driven by the same trigger contexts as in Flows, so they’re very similar when implementing them, but what if I want to calculate a one-off calculation from an Aura or LWC component?

James: I’ve included several @AuraEnabled methods as part of the base rollup library that can be accessed through Aura or LWC. Those methods are primarily meant to support full (one-off) recalculations, but the other methods within the base Rollup class could also easily be wrapped to support being called from the frontend. 

In general, I’ve based the API for the base rollup class around exposing functionality via Flow or directly within Apex; if people needed more options for calling rollup methods from within Aura, LWC, or elsewhere, I’d be happy to hear about what they’re looking to try to do. If it sounds like a use case that should be more generally available, I can add (or annotate existing) methods to do that.

Atlas: This is great, but one of the requests I used to get is to roll up amounts to the grandparent records. Does Apex Rollups support this? And one more – I just installed the repo, how would I calculate rollups for the existing records?

James: This was a request from one of our mutual friends within SFXD, and I’m very happy to say that you can use Apex Rollup to roll values up directly from a grandchild record straight to its grandparent. You can also do “ultimate parent” lookups for things like Parent Accounts, or any other hierarchical lookup field where the relationship is to the same object.

On the subject of calculating rollups for existing records, many work in an “ongoing” fashion – so to properly set the existing values, I’ve provided a “Rollup” application accessible via the app picker. This application allows you to either kick off one-off full recalculations for an individual rollup, or kick off a job that performs all rollups for a given object based on Custom Metadata (CMDT is the recommended approach for configuring rollups within an org).

The Power of Online Communities: SFXD

Atlas: Thanks for clarifying – these are great to know. I’m glad you mentioned SFXD (The Salesforce Discord Exchange) earlier – and I sure do love talking about it – but I wanted to ask you about your experience joining SFXD. How would you describe it to people?

James: The timing of joining SFXD at the beginning of the pandemic could not have been better. Again, I don’t want to sugarcoat anything – last year was clearly a trying time for everyone. That being said, I think that SFXD provided a safe haven for many talented people who were passionate about Salesforce but didn’t necessarily know what to do with that energy. I would describe it as a help forum combined with a general opportunity to talk shop.

It has an energetic environment indicative of passionate, hard-working people looking to connect, and unlike a traditional social network associated with work, it maintains a looser feel.

There are a lot of personalities, and I can appreciate those as much as the intellect that they represent!

It’s been my great pleasure to connect with people there; to learn and to be able to teach; to see how other people are embracing or struggling with different trends in programming and declarative development. Certainly, I would say that my knowledge of Flow has benefited tremendously merely by having absorbed some of the knowledge that the Flow gurus on SFXD have put forth. Collectively, we’ve all benefited from having the chance to meet and get to know one another!

Atlas: This question is just for me: favourite book of all time, and why?

James: That’s an impossible question! As somebody who’s also self-published their own fantasy/sci-fi book, I have way too many favorites to choose just one! For a self-contained novel, I have a huge amount of love for Jonathan Strange & Mr Norrell by Susannah Clarke – that book was an instant classic, and I’m due for a re-reading. For a multi-book series, I was absolutely blown away by the irreverent wit and fantastic story in first Gideon the Ninth and then Harrow the Ninth by Tamsyn Muir.

Summary

Thanks to James for answering my questions – it has been interesting to learn more about his journey into Salesforce, as well as the origins and possible uses of Apex Rollup. If you too can see the joys of Apex, be sure to visit James’ blog.

For further reading around Rollups, you can check out the following posts:

Add Comment