Skip to main content
Hi All

 

I've had a working trigger on opportunity update that would start an apex method if a formula field is set to true.

 

below is the formula field 

AND( Initial_Meeting_Held__c=TRUE, Agreed_Need__c =TRUE, Project_with_budget__c =TRUE, Signator_Identified__c = TRUE,Internal_Bid_Team__c = TRUE )

This stopped working this week without any changes being made to the trigger or any apex code. 

 

The condition for the trigger is being met(i've double checked the values in the Database with dataloader). But i get no logs  if I update the opportunity. So i created a copy from production to sandbox to debug. But in the sandbox, the trigger fires and everything works fine. Did anybody else experience this issue? Or does anybody have a fix? Cause i have no idea what's wrong. 

 

Trigger:

trigger UBWTrigger2 on Opportunity (after update) {

Id a;

Id d;

// static boolean to stop recursion(start as true), UBWClass.UBWInterface will put // this on false

if(OpportunityTriggerHandler.deAllerEersteKeer == true)

{

try{

for(Opportunity p : Trigger.new)

{

Id a = [select Id from Account where Id =: p.AccountId limit 1].Id;

Id d = [select Id,SubGates1__c from Opportunity where Id =: p.Id limit 1].Id;

if(p.SubGates1__c == true)

{

UBWClass.UBWInterface(a,d);

System.debug('UBW Interface Fire');

}

}

}

catch(Exception e)

{}

}

}

 

 
9 answers
  1. Oct 18, 2018, 10:58 AM
    I'll add some error handling into the trigger with my next update, i'm going to update the ubwclass to use queueable instead of a future method anyway :)

     

    But good news, seems i found out the issue.I indeed had some update logs and was able to compare production and sandbox. I've found out that the static variable to stop recursion doesn't get reinitialised before the trigger, so the boolean is false and it doesn't run. But on sandbox it works as expected and the boolean is true. 

     

    So guess i'll need to find out why it's false on production
0/9000