3

I have a variable in a managed package that has been declared final:

global final Quote__c quote;

Can I remove the final keyword in a future release of the managed package, or will Salesforce prevent me from doing so?

5
  • I've never worked with managed packages, but it seems like something that should be allowed.
    – Adrian Larson
    Jun 20, 2016 at 18:50
  • @AdrianLarson I wish I could say the same) Salesforce is not really flexible on that point. I can not find a proof that it is impossible, but I wasnt able to delete old unused global variable in class or global class in managed package. As well as change endpoint prefix for apex rest. Probably, you can user deprecate keyword
    – kurunve
    Jun 20, 2016 at 21:22
  • @kurunve: Is the final keyword considered as part of the member signature? I went to the class definition under Setup > Develop > Apex Classes for the managed package and it does not specify that the member is final. Jun 20, 2016 at 23:38
  • 1
    You should be able to just edit a previously uploaded global final member in a package to make it non-final. If it saves, then it's permitted, and if not, then it's not. The documentation does not cover if this is allowed, so the easiest way to know would be to experiment (and then self-answer your question so we can benefit).
    – sfdcfox
    Jun 21, 2016 at 3:30
  • @sfdcfox My understanding is that you cannot edit fields in a managed Apex Class. I have changed the field in the unmanaged version of the package and have deployed the changes to a CI org, which successfully created a beta package. I cannot test the upgrade scenario until I generate a GA package. I will post back with my results. Jun 21, 2016 at 17:45

1 Answer 1

2

After removing the final keyword, the package uploaded successfully. I have tested upgrading using the package and it worked successfully. It seems Salesforce will not restrict you from toggling the final keyword between packages.

0

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.