Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Questions tagged [recursion]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
-2 votes
1 answer
234 views

how to prevent recursion in flow [closed]

I am creating a rollup summary on account's related contacts using flow in salesforce And currently getting issue with recursion in flow, I have created two flow for creating and updating records and ...
user avatar
0 votes
0 answers
63 views

Phantom Runaway Queuable Job "Limit Check"

I have some very strange sandbox behavior - there is a runaway queuable job that appears to be doing absolutely nothing in the system, last only .006 seconds, and completely locks up the system as it ...
user avatar
  • 628
2 votes
1 answer
283 views

Apex Trigger Is Firing Twice on Record Insert?

EDIT: SOLVED by Nagendra Singh I had messed up my trigger calling for an ifBefore > all triggers, then calling for all the triggers again after the ifBefore clause. I added an else clause to fix ...
user avatar
2 votes
2 answers
59 views

Best practice for migrating from same-record update Process Builders/Workflows to before-save Flows

First there was Workflow, and we built separate workflows for each process/action on an Object. Then there was Process Builder and Flow, and we were advised as a best practice to create a single ...
user avatar
-4 votes
1 answer
413 views

Recursive query to get all parent records in lookup relationship [closed]

Let's say we have parent__c field in MyObject__c object that is lookup to itself. Is it possible to get all parents for particular child (highest parent has null value for parent__c)
user avatar
  • 687
0 votes
2 answers
59 views

Recursive helper function throws component.get is not a function

I have a recursive helper function that checks every 5 seconds for the status of a queueable job. Upon the first recursive call, the helper method throws Uncaught Error in $A.getCallback() [component....
user avatar
0 votes
1 answer
123 views

Can we manage Trigger recursion in Platform events

I have a scenario where I have to keep 2 objects in sync. When Object_A is updated, i need to update Object_B. When Object_B is updated, i need to update Object_A. I can do it using trigger and avoid ...
user avatar
0 votes
3 answers
865 views

How to prevent executing some method from running twice

I have a static method named ABC in apex which is called multiple times from aura due to iteration. So in ABC I have few methods which need to be called only once in the first iteration. How can I ...
user avatar
  • 229
0 votes
0 answers
139 views

Possible Trigger and Process builder recursion

I have created a Trigger on Order object. There is a field called pacing in both Order and Order product Objects. When the Pacing is updated in the Order, I am updating the Pacing field in the Order ...
user avatar
0 votes
3 answers
67 views

Recursive Trigger Issue [duplicate]

I have this code for a trigger, that according to my logic, should break on the second run, given an if statement I setup, but I'm still getting an error related to maximum trigger depth. Here is my ...
user avatar
0 votes
1 answer
94 views

separate handler instance for recursive trigger

This is more of a conceptual question related to Apex. We have a functionality where we have case trigger. That trigger creates child cases, so case trigger runs again. This is what case trigger looks ...
user avatar
0 votes
1 answer
81 views

trigger recursion and workflow and non workflow fields

I am trying to sync opportunity to third party only when fields of opportunity gets changed. By comparing the oldMap and newMap, I determine whether there is a change in fields or not, and if I ...
user avatar
  • 197
0 votes
1 answer
236 views

Apex Trigger for Updating Sibling Records

I have an object (call it "Details") with data that would look like this: +------------+------------+-----------------------+ | Sequence # | % of total | Cumulative % of Total | +------------...
user avatar
  • 115
0 votes
1 answer
88 views

OpportunityLineItem Trigger - Recursion -Product Dependency

I have a Custom Object(Product_Dependency__c) to define dependency between 2 Products with 2 lookup fields to Product. The first lookup is the Controlling product and the second is the dependent ...
user avatar
  • 423
0 votes
1 answer
841 views

Process builder and flow resulting in recursion

Currently, in the process builder if you create a process and invoke a flow that will update multiple records for the same object, the process is again triggered for the records it updates, since the ...
user avatar
  • 1
0 votes
1 answer
110 views

Recursive trigger static variable and multiple inserts

I have a scenario where I have an Apex code that runs two inserts on my custom objects, and they can't be bulkified because the Id of the first insert is used in the second one. I have an after ...
user avatar
  • 1,576
0 votes
1 answer
389 views

How to use Messaging.SingleEmailMessage to force stop sending emails to email addresses that no longer exist / email server problem

So I have created a button on a Visualforce page to call the controller to send an email like so. It works perfectly for valid emails but little did I know the hell that came when I sending it to ...
user avatar
  • 1,061
0 votes
2 answers
86 views

Simple Lead Assignment Causing Trigger to Fire 4 Times

I've seen my share of recursion issues, but this one is strange. I have fairly simple code triggering lead assignment rules to run when a field (New_Company_HQ_State__c) is changed on a lead. The ...
user avatar
  • 628
0 votes
4 answers
1k views

Recursive Algorthims In Apex

This is really just a general CS question. I have been trying to increase my knowledge of algorithms and data structures. And of course, every CS class is full of examples of recursive algorithms. ...
user avatar
11 votes
2 answers
828 views

What is a good pattern for recursion blocking in generic trigger handlers?

Here I'm talking about a handler that covers all the TriggerOperations and that accepts SObjects of arbitrary type. And the recursion problem is where a change caused by a trigger results in that ...
user avatar
  • 129k
0 votes
1 answer
2k views

Recursive record update by flow

I have a simple process builder that triggers a flow to update a record and whenever the flow does, all the workflows and process builders related to the object are triggered the second time. Is ...
user avatar
  • 1
0 votes
3 answers
378 views

Trigger Recursion after API Callout to Run Territory Assignment Rules

I am trying to trigger territory assignment rules on accounts via the API (the only way you can, apparently), and then change the account owner based on the territories that are assigned. It’s an ...
user avatar
  • 628
0 votes
1 answer
354 views

Two Queueable jobs keep triggering the same trigger

So we have managed package that have a trigger on update Contact, lets call it Trigger1. Trigger one call a manged Queueable class that updates Contact. We have Trigger on update for contacts, lets ...
user avatar
0 votes
0 answers
25 views

Recurring Events Lightning - Repeat field is not writable. How to use this field in custom lightning page? [duplicate]

I am trying to create a bulk action on recurring events. Isrecurrence2 field is not writable in the controller. How to create recurring events in custom lightning pages. The image is from my ...
user avatar
  • 55
2 votes
1 answer
185 views

How to control the occurrence of String.valueOf() and other methods for this trigger framework?

We are using below Trigger framework public virtual class TriggerHandler { // static map of handlername, times run() was invoked private static Map<String, LoopCount> loopCountMap; ...
user avatar
  • 379
0 votes
0 answers
173 views

boolean flag value not preventing the recursion in trigger

I need to prevent the recursion in after update. Can't use before update for some reason. Kindly suggest why recursion is not getting prevented. Public static Boolean flag=true; if(flag){ flag=false;...
user avatar
  • 59
0 votes
0 answers
353 views

Process Builder recursion issue: repeats actions 6 times

I'll skip the overall context and just describe the current issue at hand. I have a Process Builder on Object X, with Recursion turned ON. We need recursion turned on for all our automation to work ...
user avatar
  • 385
0 votes
0 answers
97 views

Setting Recursion Flag in Process Builder prevents Process Builder from Running Flow

I have a process builder and flow combo I have been building. I finally got it to work, but had to turn off the Recursive Flag on the opportunity in order to get the flow to be scheduled from the ...
user avatar
  • 1,268
6 votes
1 answer
2k views

Best way to avoid trigger recursion as using static boolean variable processes only first 200 records

What is the best way to avoid recursion of trigger ? Below are the approaches used and problems faced Using static boolean variable from handler class Apex Class public Class checkRecursive{ ...
user avatar
  • 6,313
1 vote
1 answer
613 views

Why isn't my platform event chain working?

I've create the following method: //@NotForProduction public class TEST_SandboxDataFactory { public static void create() { List<String> sObjectTypeNameList = new List<String>()...
user avatar
0 votes
1 answer
126 views

Why isn't my Queueable chain working?

I have the following class, none of the dependencies invoke Queueable: public class TEST_SandboxDataFactory { public static void create() { List<SObjectType> sObjectTypeList ...
user avatar
0 votes
1 answer
402 views

Trigger Depth Exceeded without Recursion

I have a trigger that is hitting the 16 depth limit. I may not understand how the trigger works. I'm fairly confident that the classes and methods I have are not recursive. They work fine, but I have ...
user avatar
  • 1,018
0 votes
1 answer
29 views

Why it is not updating the YourMail__c after Recursion Handling?

Class: public class Hr { public static Boolean f_t = true; } Trigger: trigger HandleTrigger on Input__c (before insert) { if(Trigger.isInsert){ if(Hr.f_t){ Input__c acc = new ...
user avatar
-1 votes
1 answer
39 views

Creating fulsome combinations of list elements

I have been having some issues getting the logic down for the following: Simplifying, I have an N-element list of Skids defined as: public class Skid { public Integer length { get; set; } ...
user avatar
  • 1
1 vote
2 answers
771 views

Is there any way to have a guaranteed order of operations with multiple triggers on the same SObject?

Our Salesforce org depends on about 20 managed packages, many of which include their own SObjects, and many of those SObjects have their own trigger operations. But we also need to do our own things ...
user avatar
2 votes
1 answer
79 views

Attempt to do recursion in Apex

This simple method I wrote is an attempt to mimic the equivalent iterative method (I'm just curious about recursion in Apex). It must return the element of a list of custom objects that have the older ...
user avatar
0 votes
1 answer
1k views

Recursion in Trigger and Process builder

I have a before update/insert trigger on Contact trigger ContactTrigger on Contact (before insert, before update) { for(contact con:Trigger.New){ If (con.FirstName ==con.LastName){ ...
user avatar
0 votes
0 answers
378 views

Issue In platform event after Insert Calling twice due to Process builder

I have created one platform event and publishing the json in it on account creation. I have one Process builder which populating the field on account creation. the issue is my Platform event is ...
user avatar
  • 105
1 vote
2 answers
136 views

Best way to process the records in After Update triggers - Sets or Lists

This may be a very primitive question but am failing to choose the best way and am trying to follow the best practices. We have many Salesforce Apps implemented, as a result there are many record ...
user avatar
  • 187
2 votes
1 answer
902 views

JavaScript Promise Chaining in lightning component has transaction issue in server side

I have a requirement , where I want to call server methods multiple times passing some value as parameter. I have used javascript promise to call the methods one after another using .then When I am ...
user avatar
0 votes
1 answer
519 views

Order of execution and multiple DML in a single transaction

I have a trigger that has multiple DML operations in a single transaction. I also only want the transaction to run once. With the order of execution I need to put some sort of "first run" logic on it....
user avatar
  • 3,177
0 votes
1 answer
267 views

Does OldMap Change During Recursion?

I wrote some code on Opportunity that compares new values to OldMap values and should execute a record clone only if the record was JUST Closed Lost. I'm not sure if my interpretation of OldMap is ...
user avatar
0 votes
1 answer
456 views

Before update trigger is not fired after setting recursive method

I wrote a method inside my triggerhandler class to avoid trigger recursion. But even after that , before update is not getting called. I'm updating a datetime field(FieldA) from Process Builder. And ...
user avatar
-1 votes
1 answer
594 views

CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, maximum trigger depth exceeded

Here is my apex class : public class AdobeToLead { public static void leadFunctionalities(List<Lead> leads) { Set<String> accNames = new Set<String>(); List&...
user avatar
  • 9
2 votes
1 answer
95 views

PDF Attachment Recursion

I have a VF page rendered as pdf that has an action=savePDF(). This uses the getcontent() function to save the pdf to the parent record. However it is recurring and causing 5 copies of the pdf to ...
user avatar
  • 370
0 votes
1 answer
705 views

Process Builder: Is "evaluate a record multiple times" inherited to sub-processes?

When creating a Lightning Process, you can choose the flag "Allow process to evaluate a record multiple times in a single transaction". If a process A invokes a sub-process B, does the setting on ...
user avatar
  • 1,154
0 votes
1 answer
22 views

Can't Code Recursive-ish Single-Object Business Requirement -- is it me or the requirement?

Given this background: Firstly, a workflow or something on Contact is already in place that updates Contact.High_School_Lookup__c when a user saves a change to the value of Contact....
user avatar
  • 1,129
0 votes
1 answer
496 views

Avoid Recursive Trigger Calls - expected behavior question

If code block 1 and 2 are in the same synchronous execution context , assuming use of the anti-recursion pattern in knowledge article 000133752 below, assuming I want both code block 1 and 2 to run ...
user avatar
  • 1,080
2 votes
2 answers
4k views

Before Trigger & Formula Field Reliability

I have the following code in a before-insert/update trigger: for(Contact c : newCs) { // newCs is Trigger.new // Various "inside the main Contact-trigger-for-loop" actions go here //... ...
user avatar
  • 1,129
13 votes
1 answer
526 views

Counting each record's Nth degree of mutual or directional edges in a (many to many) graphical network of < 50,000 rows/nodes

Summary I have created a many-to-many network graph relationship (social network). A Person can have many Friends. A Friend can be a friend to many Persons. Full object model (ERD) is given at the ...
user avatar
  • 1,080