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
Rajesh T 19Rajesh T 19 

Error: Class name is already in use or has been previously used

There is already  Apexclasses in our Sandbox and our team modified some methods in few classes and tried to save but facing the above error. Can anyone please tell about why this is happening ?
SwethaSwetha (Salesforce Developers) 
HI Rajesh,
Can you perform below troubleshooting steps and share your inputs

>Can you compile all classes and then try to save the class?
>Can you run the below query in Workbench with include and exclude to see the number of rows returned:
SELECT ApiVersion,Body,Name FROM ApexClass WHERE Name = 'YourClassName'
>Can you check if there is any managed package with the same classname that has been installed in your Org?
>Can you use an IDE like Eclipse to update the class name and see if it throws the same error?

Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you
Rajesh T 19Rajesh T 19
Hi Swetha,

Thanks for the reply. Please see the updates,
> Compiled all classes and tried but not saved
> Query returns one class only
> There is no Managed class with same name.
> By Eclipse it throws same error.

 
SwethaSwetha (Salesforce Developers) 
Can you empty your recycle bin and see if that helps?

Also, capture the debug logs during the deletion and see if there is anything odd.

If these steps do not help, please log a case with salesforce.com support and share the case number here so I can take a look.

Thanks
Swetha Maddali
Senior Sucess Engineer Tier 2 
Salesforce support
Rajesh T 19Rajesh T 19
Hi Swetha,

None of the option doesn't worked. As suggested we raised an Salesforce case and it got resolved now.

Thanks,
Rajesh