How to Avoid the Pitfalls of Salesforce Triggers

How to Avoid the Pitfalls of Salesforce Triggers

THE BRIEF

The client, a 60 year old established B2B leader in their industry, was undergoing a digital transformation to support and optimize their national operations. In 2009, they adopted Salesforce as their primary platform to unify and expand their sales operations. Today, they are completely operational on the platform, leveraging marketing, sales, service and field service lightning. The decade old system organically grew into inconsistent and impaired processes being developed by disparate teams. This adversely impacted the performance and efficiency once intended to be the value drawn from the Salesforce platform.

THE CHALLENGE

One of the attractive capabilities of Salesforce is its automation. Repeatable processes that are often mundane and costly for humans to maintain are suitable use cases for Salesforce automation. The client took advantage of this across multiple business units, automating as much as they could in order to become more efficient in their performance. The challenge became apparent to the client as they noticed certain automated triggers misfiring, or worse, not firing at all.

A trigger is Apex code that executes before or after the following types of operations:

In the case of the client, multiple triggers were created, often without documentation or the ability to trace where the trigger is firing, leaving the client with competing executions that would misfire, preventing the automation from working. Records that were updated by customer service reps were not able to be saved, preventing other related records that were meant to be automatically updated from taking place. The more triggers they created the more complex the challenge became as the developers failed to document where an automated trigger starts and where it ends.

THE SOLUTION

The client partnered with Apexon to consolidate Salesforce triggers to improve the overall performance of their Salesforce instance by controlling the order of execution for the existing trigger functionality. New documentation defining each trigger and its process was also developed to support the maintenance and growth of the platform, previously, no documentation existed.

THE RESULTS

In the end, the client increased user performance by 45% and the development team reaped the benefits of gaining visibility into the consolidated set of triggers in the following ways:

  • Reusability: There will be no need to copy code
  • Simplicity: every “trigger” was reduced to just two lines of code in the master trigger, leading to an object-oriented codebase that is more organized, predictable, and modular too.
  • Control Execution Order: in Apex, “the order of execution isn’t guaranteed for multiple triggers on the same object.” All triggers for the client were consolidated to one per object ensuring they fire in a controlled environment.
  • Debugging Issues: It will be easier to debug any issues from the triggers/classes. The primary advantage is control of execution.

PARTNERSHIP PLATFORMS/SOFTWARE

Interested in our Insights Services?

Please enable JavaScript in your browser to complete this form.
Checkboxes
By submitting this form, you agree that you have read and understand Apexon’s Terms and Conditions. You can opt-out of communications at any time. We respect your privacy.