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
    Commented 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
    Commented 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. Commented 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
    Commented 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. Commented 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .