Questions tagged [recursion]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
18 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 ...
0
votes
3answers
57 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 ...
0
votes
1answer
24 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 ...
0
votes
1answer
47 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 ...
0
votes
1answer
83 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 | +------------...
0
votes
1answer
32 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 ...
0
votes
1answer
104 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 ...
0
votes
1answer
26 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 ...
0
votes
1answer
178 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 ...
0
votes
2answers
36 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 ...
0
votes
0answers
71 views

Flow Paused Element causing Duplicate Record Creation

I have an autolaunched flow that is called from a process builder criteria when a text field on the contact is changed. The first step in the flow is a pause element to avoid the following error: ...
0
votes
4answers
603 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. ...
11
votes
2answers
536 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 ...
0
votes
1answer
343 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 ...
0
votes
3answers
165 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 ...
0
votes
1answer
79 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 ...
0
votes
0answers
23 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 ...
2
votes
1answer
89 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; ...
0
votes
0answers
70 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;...
0
votes
0answers
209 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 ...
0
votes
0answers
49 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 ...
6
votes
1answer
932 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{ ...
1
vote
1answer
360 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>()...
0
votes
1answer
52 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 ...
0
votes
1answer
126 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 ...
0
votes
1answer
28 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 ...
-1
votes
1answer
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; } ...
1
vote
2answers
409 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 ...
2
votes
1answer
51 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 ...
0
votes
1answer
688 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){ ...
0
votes
0answers
215 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 ...
1
vote
2answers
76 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 ...
2
votes
1answer
718 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 ...
0
votes
1answer
374 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....
0
votes
1answer
198 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 ...
0
votes
1answer
367 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 ...
-1
votes
1answer
311 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&...
2
votes
1answer
75 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 ...
0
votes
1answer
590 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 ...
0
votes
1answer
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....
0
votes
1answer
328 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 ...
2
votes
2answers
3k 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 //... ...
13
votes
1answer
420 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 ...
0
votes
1answer
472 views

isAfter is not working properly in apex trigger

I have built following apex trigger code and isAfter code is not executing because I have used recursive method in this trigger. Is it possible to run isAfter while trigger call first time ? Please ...
1
vote
1answer
57 views

Is it possible to have a validation rule with a finely nuanced loophole to create and modify detail records?

We have Opportunity with a custom checkbox property "Locked__c". While this value is set to true (never mind how), it should be impossible to change any value on the Opportunity. The Opportunity has ...
3
votes
3answers
760 views

Avoid trigger trigger execution several times - Best Practices [closed]

I've been looking for a while for best practices when trying to avoid recursive trigger execution, but I haven't really found anything that I like. At the moment, the most straight forward solution I ...
0
votes
1answer
278 views

Insert failed: maximum trigger depth exceeded Opportunity trigger event

Getting a recursive error when im trying to add a new OLI to my opportunity, this only comes up when i add a specific product called delegate pass, Ive tried to debug but it seems to hit the trigger ...
0
votes
1answer
147 views

Process Builder Cyclic Edits (Two Objects) - ObjectA touches ObjectB touched ObjectA

With the exception of using Timed actions in Process Builder (where it takes at least a minute if you set it for "an hour ago"), is there a way to have two Flows that cause Object A to touch Object B (...
3
votes
0answers
397 views

Is there a VLOOKUP function available for updating fields in a record?

Is there a non-apex way of updating a Boolean field on a record based on a comparison of values of a different field of all (or a filtered selection) the records in the table (object) to which the ...
0
votes
1answer
454 views

Trigger looping and Trigger.oldMap data changing

I have an issue with a trigger on opportunity. I have a method X in my opp_Handler that when opp.stageName changes to 'Closed Won' to execute code... the problem is, I have many methods my trigger is ...