function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
bob17bob17 

Issue removing a Trigger from a managed package

I have a managed package that had 2 triggers on the same object.  There were fired on completely different operations by the CheckMarx scan kept saying that multiple triggers on the same object is a bad thing so as part of a maintenance release I decided to consolidate the two existing triggers into a single new trigger.  I was able to delete the old triggers from my org and build a new version of the package (beta build at the moment) that only contained a the new single trigger.  Install into a clean environment and the one and only trigger is installed and everything works great. 

 

So far, so good.  However, when I install the new version into an org with the old version it does not remove the old triggers.  Now I have 3 triggers instead of 2 and if all are firing then I am doing everything twice.  All 3 are listed as Active but I can't tell if all 3 are firing.

 

Anyone have a clue as to why if I was able to remove the triggers from my org/package the upgrade install will not remove the old triggers? 

 

Thanks,

 

Bob

Best Answer chosen by Admin (Salesforce Developers) 
A_SmithA_Smith

The difference is the beta status of the version.  Betas don't delete things on upgrade.  A released version would remove the trigger as expected.

 

Thanks,

All Answers

A_SmithA_Smith

The difference is the beta status of the version.  Betas don't delete things on upgrade.  A released version would remove the trigger as expected.

 

Thanks,

This was selected as the best answer
bob17bob17

THANK YOU Mr. Smith!  Once I built as a Release Managed package it did remove the obsolete triggers on an upgrade install.

 

Bob

bdstangbdstang

I have a similar problem.  I have a managed/released package that has a trigger removed from the package, and even deleted from my Dev org.  Yet, when I install the new package in an org that had the old trigger in it, it doesn't remove it.  I have confirmed & re-confirmed that the package is managed/released.

 

Thoughts?

A_SmithA_Smith

This should work.  If you are experiencing issues, I'd log a case with the details so support can investigate.

 

Thanks,

 

bdstangbdstang

Thanks Andrew, I'll do that.

bdstangbdstang

Andrew,

 

I did post a Case and was told the following:

 

"Apex triggers can be deleted in developer org but they are not subscribers deletable.

Workarounds:

1. Uninstall the package version from all orgs, we will change the package to Beta -> remove Apex trigger -> reupload and reinstall

2. Make the trigger inactive by Apex code in the next version of the package"

 

Is this true?  I'd REALLY rather not have to uninstall the app, and more importantly, the data, just to inactivate a now unneeded trigger. If true, this seems like a massive hole for SF.

 

Please let me know your thoughts.

 

Brent

 

A_SmithA_Smith

Can you post your case number and I'll follow-up?

bdstangbdstang

Thanks Andrew.  The Case Number is 03913674.

 

Appreciate the help.

 

Brent

Paul Dyson.ax812Paul Dyson.ax812

We've just hit this problem too and our case number is 03960706. Deleting the package and re-importing the data is really not an option for us.

 

 

KnewTVKnewTV

I have a similar problem....

 

I am getting errors from a trigger that automatically converts leads to contacts.

 

This trigger has worked for a long time. Just loaded the app into a fresh ORG and everything works fine.

 

Upgraded an existing customer and now we are getting errors.

 

Apex script unhandled trigger exception by user/organization: 00580000001jxyj/00D80000000ba1e

ri.AutoConvert: execution of AfterInsert

caused by: System.DmlException: ConvertLead failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, System.DmlException: Update failed. First exception on row 0 with id 00Q8000000jraIwEAI; first error: CANNOT_UPDATE_CONVERTED_LEAD, cannot reference converted lead: []

(System Code)

External entry point

Trigger.ri.AutoConvert: line 13, column 59 

 

Would like to remove the trigger from the package but unclear on exactly how to remove the trigger and the class. Tried to deactivate the trigger and upload the package but this cased errors in the package.

 

Case 04107019