Questions tagged [recursion]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
14 views

Before update trigger not updating the second Contact record [closed]

Guys my before update trigger is as follows.The parent Account has only 2 Child Contact. Whenever boolean field is checked on the first contact it should update the second contact. Set<Id> ...
2
votes
1answer
30 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
26 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
40 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
12 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 ...
4
votes
1answer
179 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
147 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
41 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
55 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
38 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
1answer
81 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 ...
1
vote
1answer
42 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
169 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
116 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
56 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
426 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
213 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
111 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
176 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
80 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
53 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
463 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
244 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 ...
1
vote
2answers
1k 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 //... ...
12
votes
1answer
349 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
327 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
53 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
557 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
154 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
63 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
295 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
231 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 ...
3
votes
1answer
408 views

Trigger recursion error

I have set up my Case trigger with a single trigger and separate methods class to handle the activities. I have added a Recursion Handler class to try and prevent the recursion happening, but this ...
0
votes
2answers
115 views

How to avoid recursion on Parent and child object when performing DML operation?

I have 2 fields on opportunity object Contact Start Date and Contact End Date which is of type date field.Based on the no days,I am adjusting Product Values which is OpportunityLineItem(we have a ...
1
vote
1answer
87 views

Can Anyone Tell Me How to Write Variable In Test Class

I have the following test class but when I try to deploy, I get variable does not exist and only in prod - Variable does not exist: CheckRecursive Public Class: public Class checkRecursive{ private ...
0
votes
1answer
466 views

after update SELF_REFERENCE_FROM_TRIGGER recursive save [duplicate]

I'm new to salesforce (apex - trigger) development and I'm currently reading through the manual and other threads on here on how to do this stuff, but I wanted to put this out here in case it was a ...
0
votes
1answer
825 views

Test Class for recursive trigger class

I have the following class which I put into a Contact trigger and in sandbox it gets 100% coverage. However, I can't deploy to prod with the Contact Test class. (0% code coverage) I wrote a test ...
7
votes
1answer
384 views

Alternatives to Static Booleans to Prevent Recursion

So using static booleans to prevent recursion has it's limitations, I recently found an issue with time based workflow: In case they fire independently–Ensure that your Apex logic is scoped for a ...
5
votes
1answer
193 views

CheckRecursion class not working

I predicted we would run into recursive triggers with a project that we are currently working on. To pre-empt this, I searched for solutions and came across this: Avoiding Recursive Triggers I ...
3
votes
1answer
354 views

Insert OpportunityLineItem - Error

I am trying to automate the following functionality: When an opportunity stage becomes 'Pending Payment', insert 2 'OpportunityLineItems' using 2 predefined Products. This is my current code. I am ...
1
vote
1answer
500 views

maximum trigger depth exceeded Opportunity trigger event AfterUpdate for [006R0000009RdT1]

The Trigger below i'm getting error when my IF statement has more that 2 conditions, I Understand it is a recursion issue. However not sure how to fix this, so i can include all the conditions below ...
0
votes
1answer
539 views

Static variable used for Recurssion check

Scenario: I have two objects - Object A and Object B.Object A has recursion checking mechanism using Static Boolean variables covering different events(IsBeforeUpdate,IsBeforeInsert etc..) I have two ...
0
votes
1answer
1k views

error when trying to approve request

hello i created a trigger who auto submit the approval request into the approval process. when i create opportunity with the entry criteria of the trigger and the procces i get to approval requeset if ...
2
votes
3answers
1k views

RecursiveCheck prevents trigger from running during tests

I am writing a test class to a handler class called from a trigger. And due to recursive trigger I had to implement CheckRecursive in the trigger and this works fine, until I start testing. Then the ...
2
votes
1answer
2k views

Process Builder: how to make recursion work

I have a number of Process Builder processes on the Case record, which do various field updates. I am aware that I cannot control the order in which these fire, but some of the processes are ...
6
votes
4answers
1k views

best way to handler trigger Recursive call

Below is my code snippet that I have used. And also I used static Boolean to handle the recursive call. But when I update more than 200 records then trigger only process first 200 record not all the ...
2
votes
2answers
66 views

Why is my Update trigger executing before Insert trigger?

In the attached debug screenshot, you can see that - according to the CODE_UNIT_STARTED and FINISHED lines, the execution seems to be going like this: Record A is inserted CODE_UNIT_STARTED: ...
0
votes
1answer
49 views

Control not entering the handler class

I have written an after update trigger on the Content Version and I have used a boolean to check recursion Handler : public Class checkRecursive { private static boolean run = true; public ...