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
as6as6 

How to deprecate a method?

Hi readers,

I wish to deprecate a method. My method is global. It is in a global class. The global class is included in a managed package.

Yet, when I add @deprecate annotation in front of my method, I get the compilation error:
    "Only managed identifiers can be marked deprecated"

I guess, my problem will get solved if I somehow make my method a managed identifier. But, I don't know what is a managed identifier. I searched a lot but couldn't find anything about managed identifiers yet. Please help me out.

For your convenience, I've uploaded the Managed Package containing the class which contains this method.
Installation URL of my managed package is:
https://login.salesforce.com/?startURL=%2Fpackaging%2FinstallPackage.apexp%3Fp0%3D04t900000008vrj
Best Answer chosen by Admin (Salesforce Developers) 
A_SmithA_Smith
Is your package released?  You can only deprecate global, released methods.

All Answers

A_SmithA_Smith
Is your package released?  You can only deprecate global, released methods.
This was selected as the best answer
as6as6

Hey Thanks A_Smith, my package was in Beta version and not in released version. So, my methods and class were not getting deprecated. I uploaded this package again in released mode. Now, I can deprecate the method as well as class. 

 

(Here's the Installation URL for installing the released mode package. 

https://login.salesforce.com/?startURL=%2Fpackaging%2FinstallPackage.apexp%3Fp0%3D04t900000008vrk)

 

Thanks A_Smith for your kind reply. I'm marking your reply as solution.