The Welkin Suite Forum

How to delete Apex classes in Salesforce production



How to delete Apex classes in Salesforce production

  • Please log in to reply

#1

ahitchings

    Posted 08 Mar 2016 and edited 26 Jul 2018

    Hi Team,


    I have tried to do this in Welkin Suite by selecting 'Delete' for an Apex Class in a production project but an error is returned. 


    Is it possible to delete Apex classes in SF production via this IDE? 


    Thanks,



    • 1

    7 replies to this topic

    #2

    kate.dulko

      Posted 09 Mar 2016

      Hi,


      Thank you for your question.


      There is no ability to delete an Apex class in your Production project via the IDE.

      This is the limitation of Salesforce.


      Regards,

      Kate


      Kate Dulko
      Customer Relations

      The Welkin Suite

      twitter: @KateDulko
      skype id: d_katerina
      e-mail: kate.dulko@welkinsuite.com

       

        


      #3

      vsevolodts

        Posted 18 Jul 2018

        @Kate.Dulko and TWS team.

        Did the answer of inability to delete a class has changed since 2016?
        The other IDEs are doing this by updating %className%.cls-meta.xml file with <status>Deleted</status>

        As of July 2018 I can't find the option to deploy only meta xml part of the class to an Org.






        #4

        kate.dulko

          Posted 25 Jul 2018


          Hi Vsevolod,


          Thank you for your post!


          Now you can do this in The Welkin Suite IDE!

          For this, please follow the next steps:

          1. change the status in a cls-meta.xml file to the 'deleted' one and save these changes;
          2. after this please open the menu Project -> Deploy to organization (I want to draw your attention that beginning from the upcoming version of the IDE this command will be present in the menu Deploy -> Deploy to Organization);
          3. select the 'Use organization from the project' - this way you will deploy to the same org that is related to your current project;
          4. in the list of files, please select the necessary Apex class file with the 'Overwrite' action and proceed the deployment process.

          As a result of this actions, your Apex class would be deleted on your org.


          Hope this would help.

          If you would have any additional questions, please let us know - we'll be happy to assist.


          Thank you,

          Kate


          Kate Dulko
          Customer Relations

          The Welkin Suite

          twitter: @KateDulko
          skype id: d_katerina
          e-mail: kate.dulko@welkinsuite.com

           

            


          #5

          michaelforce

            Posted 25 Jul 2018

            Kate, for clarity sake:  you mean we need to create a project for the production org, and then deploy back to that same org?




            #6

            kate.dulko

              Posted 25 Jul 2018

              Hi Michael,


              Thank you for your question.


              Yes, you can create a project related to your Production organization, and deploy to the same org using the 'Deploy to organization' feature.

              This way destructive changes from your cls-meta.xml file will be applied.


              Regards,

              Kate


              Kate Dulko
              Customer Relations

              The Welkin Suite

              twitter: @KateDulko
              skype id: d_katerina
              e-mail: kate.dulko@welkinsuite.com

               

                


              #7

              vsevolodts

                Posted 25 Jul 2018 and edited 25 Jul 2018

                kate.dulko, on 25 Jul 2018 - 01:36 PM, said:

                As a result of this actions, your Apex class would be deleted on your org.

                 No, it won't, at least not always.
                Scenario 1: you are deleting the test class that covers the class you want to delete. Then you need to do the same for the test class (same steps for deletion).
                Scenario 2: you want to keep the test class that is covering your class, but remove a single test from it. Here you are bumping in an issue: if you trying to delete the class that is not covered, you are getting 75% coverage requirement error. If you are deploying the test class that still covering the class, you are getting the error 'class deleted'.
                I do understand, that this is not IDE problem, but Salesforce methods of working, but I feel like the answer could be improved with the instruction on how to get it done.
                Update: the July 25th release moved the deployed menu option from "Project" to the "Deploy" tab



                #8

                kate.dulko

                  Posted 26 Jul 2018

                  Hi Vsevolod,


                  Thank you for your post with these notes!


                  Yes, when you delete an Apex Class, the necessary is to pay attention to a code coverage, since an organization requires to keep a code coverage not less than 75%. Also, this Apex class can cover or be covered by other ones, and this could lead to additional steps too.

                  In addition, there could be references to this class in other files so this should be taken into account also.


                  When all Salesforce conditions are provided, you can use the steps from my previous post to delete an Apex Class on a Production organization.


                  Regards,

                  Kate


                  Kate Dulko
                  Customer Relations

                  The Welkin Suite

                  twitter: @KateDulko
                  skype id: d_katerina
                  e-mail: kate.dulko@welkinsuite.com

                   

                    





                  Boost Your Productivity. Get Started Today

                  Try Free Trial