function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jackie rodwelljackie rodwell 

Cascading triggers causing 2 future handler methods instead of 1

As part of a project, we have developed 2 webservices. After the first call then immediately the second one is called. It is a simultaneous process invoked by a trigger. But recently we are seeing 2 future handlers instead of 1 in the debug logs. This means we are making 2 web callouts where we should be making only 1. It is resulting in unnecessary callouts. Tried using boolean value to avoid multiple callouts. But that didn't work. Please suggest how to tackle the scenario.
James LoghryJames Loghry
Do the methods update the same object the trigger is running on?  If so, you'll need to implement a recursion check using a static variable either in the trigger itself or a trigger helper class.  Another option, if this is the case, is to move the callouts into an invocable method and kick them off via a process or flow that fires only the first time a record is inserted / updated.

Otherwise, if you post your trigger and the future method(s), we could take a further look and see if there is anything else going on.  When doing this though, please use the code format button (< >). Thanks!