2

This is a general question and i would like an opinion from the experts. I have to do something on Account that is too simple and can be achieved with the use of record-triggered flow. However, we already have an Apex trigger for custom validations. What is better practice?

  1. To use a record-triggered flow separately and also keep the trigger as is?
  2. Or to just put my change on the trigger, in order to have only one point of reference for Account triggered actions and not create the flow?

2 Answers 2

4

This Best Practices for Designing Processes mentions the following

Each time a record is created or updated, all record-change processes for its object are evaluated. We recommend restricting your org to one record-change process per object

The benefits are:

  • Get a consolidated view of your org's automation for an object
  • Avoid hitting limits
  • Determine the order of operations

However, that means you could delegate the insert process for a given object to Flow and the update process for a given object to apex (you didn't specify exactly your scenario). So, your proposal of record-triggered flow and apex trigger could be following that best practice (one record-change process per object).

In terms of when to choose one over the other, the decision guide for Record-Triggered Automation is a great resource although it's highly dependent on your team's set of skills. A summary table is below:

enter image description here

The other consideration is that record-triggered flows can end up quite large/expansive if you go all-in currently. The ability to call another flow from a record-triggered flow is currently slated for Winter '22. With that, it'd give you the ability to order your record-triggered flows with some separation of concern and follow patterns that are accomplishable in apex triggers

1
1

Well, this is kind of a religion question. I personally would recommend to stick to one method, where ever possible. Either Flow or Trigger. So you are in control of what happens when. Order of execution. If you have a relative small org, it's no problem to use both. But when it grows and you have large complex flows, triggers and maybe process builder it might cause problems. I work as contractor developer and in large projects we had a couple of situations, when we had to refactor from flow to trigger. Also trigger is faster than flows, when it gets complex. But this is only my personal thinking.

1
  • 1
    Thank you for your opinion @RRI ! Commented Jul 30, 2021 at 14:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .