3

I would like to add an interface to one of our managed packages. This interfaces would be implemented by custom code in a customer org where the package is installed. It would be called from a custom trigger.

I have read here (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_interfaces.htm) that : "You cannot add a method to a global interface after the class has been uploaded in a Managed - Released package version".

Are there any other pitfalls ? What is your experience on this subject ?

3

The restriction related to "global" classes/methods is applicable across the code-base for managed package. It may be any global class, or a global method in a public class. You can not modify it once its in Managed package.

The interface would work as expected as it should. So, there is no such restriction related to interfaces. Just the Managed package limitations would apply.

  • Thanks San. You say "You can not modify it once its in Managed package". The restriction I read about applies to interface classes, not other classes. What restriction are you referring to ? – altius_rup Mar 6 '16 at 10:20
  • What we noticed is that, once you release a global interface, you cannot add any new methods to it. However, if it is global class, you can introduce new methods. This is understandable as Salesforce doens't have concept of default interface methods. Otherwise, all customers implementations will fail as they will not be implementing this new interface method. – realfire Dec 5 '17 at 18:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.