You need to sign in to do that
Don't have an account?
Brian Ford
Trigger invokes in sandbox but not in production
I have a trigger that creates a case for all new business opportunities in a closed stage with a closed date of 14 days from the current day. The trigger works as expected in my sandbox and I have 90% coverage with my test class.
In production the trigger isn't being invoked. I have a system.debug on line 10 that isn't logging. Any ideas what's causing the different behavior between my sandbox and production environments?
Trigger
In production the trigger isn't being invoked. I have a system.debug on line 10 that isn't logging. Any ideas what's causing the different behavior between my sandbox and production environments?
Trigger
trigger createCaseFollowup on Opportunity (before update) { Opportunity[] opps = Trigger.new; List<Case> caseList = new List<Case>(); for(Opportunity op : opps) { Opportunity oldOpp = Trigger.oldMap.get(op.Id); System.debug('old: ' + oldOpp.Closed_14_Days__c + ' new: ' + op.Closed_14_Days__c); //We only want the Opportunities that have the Closed_14_Days__c set to "true" and it being a New Business Opp if (op.Closed_14_Days__c && op.New_Renew__c == 'New' && !OldOpp.Closed_14_Days__c) { //Creating a blank case for assignment Case thisCase = new Case(); //Standardizing that it is a health check thisCase.health_check__c = true; thisCase.AccountId = op.AccountId; thisCase.Subject = '14-Day Health Check'; thisCase.OwnerId = '00GM0000000zzBx'; //This SOQL query is used to determine the Contact that was the primary Contact for this Op. In a Try-Catch due to the fact some Ops may not have primary contacts try { OpportunityContactRole ocr = [SELECT Id, ContactId FROM OpportunityContactRole WHERE OpportunityId = :op.Id AND IsPrimary = true]; thisCase.ContactId = ocr.ContactId; } catch(Exception e){} try { RecordType thisRecord = [SELECT Id FROM RecordType WHERE Name='Client Health Check'][0]; thisCase.RecordTypeId = thisRecord.Id; } catch(Exception e){} //Adding this newly created case to the previously instantiated list caseList.Add(thisCase); } else {} } //Check to see if a Case was generated. If not, don't worry about it. if(caseList.size() > 0) { try { insert caseList; } catch (Exception e) { } } }
Please check trigger is active in production or not.