Is there a way to upgrade api versions of all apex classes without manually updating each of them?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
1
down vote

favorite












I have an org with hundreds of apex classes, all of which have api versions ranging between 30-37. Is there an easy way to bring them all to the latest api version at once without resorting to manual updates?







share|improve this question




















  • Do you have a reason to want to do that? One of the points of the versioning is so that older code can rely on the behavior that existed when it was written and new code can opt-in to newer features by using the latest API version. Changing all the classes to the latest version would require some testing to be done to check that nothing has broken.
    – Keith C
    Aug 22 at 18:35
















up vote
1
down vote

favorite












I have an org with hundreds of apex classes, all of which have api versions ranging between 30-37. Is there an easy way to bring them all to the latest api version at once without resorting to manual updates?







share|improve this question




















  • Do you have a reason to want to do that? One of the points of the versioning is so that older code can rely on the behavior that existed when it was written and new code can opt-in to newer features by using the latest API version. Changing all the classes to the latest version would require some testing to be done to check that nothing has broken.
    – Keith C
    Aug 22 at 18:35












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I have an org with hundreds of apex classes, all of which have api versions ranging between 30-37. Is there an easy way to bring them all to the latest api version at once without resorting to manual updates?







share|improve this question












I have an org with hundreds of apex classes, all of which have api versions ranging between 30-37. Is there an easy way to bring them all to the latest api version at once without resorting to manual updates?









share|improve this question











share|improve this question




share|improve this question










asked Aug 22 at 18:17









kabdelr00

404




404











  • Do you have a reason to want to do that? One of the points of the versioning is so that older code can rely on the behavior that existed when it was written and new code can opt-in to newer features by using the latest API version. Changing all the classes to the latest version would require some testing to be done to check that nothing has broken.
    – Keith C
    Aug 22 at 18:35
















  • Do you have a reason to want to do that? One of the points of the versioning is so that older code can rely on the behavior that existed when it was written and new code can opt-in to newer features by using the latest API version. Changing all the classes to the latest version would require some testing to be done to check that nothing has broken.
    – Keith C
    Aug 22 at 18:35















Do you have a reason to want to do that? One of the points of the versioning is so that older code can rely on the behavior that existed when it was written and new code can opt-in to newer features by using the latest API version. Changing all the classes to the latest version would require some testing to be done to check that nothing has broken.
– Keith C
Aug 22 at 18:35




Do you have a reason to want to do that? One of the points of the versioning is so that older code can rely on the behavior that existed when it was written and new code can opt-in to newer features by using the latest API version. Changing all the classes to the latest version would require some testing to be done to check that nothing has broken.
– Keith C
Aug 22 at 18:35










2 Answers
2






active

oldest

votes

















up vote
4
down vote



accepted










WARNING




First of all, I would like to say, do this only if you are certain you have sufficient unit tests to catch anything that might break. Also, make certain you back up your code. I cannot stress this strongly enough.




You can do this pretty easily with any IDE, Salesforce DX, workbench, etc. The general process is either two or three steps.



First, download the files you want to update the API version for. Next, use a tool to "Find and Replace in Files". All major IDEs have this feature. Replace <apiVersion>.+</apiVersion> (a regular expression match) to the desired version. Third, if your IDE doesn't automatically deploy the changes, deploy the changes back to the server.




Force.com IDE (Search > File)



Find Version to Replace



Replace Version






share|improve this answer





























    up vote
    3
    down vote













    Firstly, do heed sfdxfox's warning. It is very important to backup your metadata before embarking on such a large scale update of the api versions.



    Make sure you run all the test cases before and after to look for things breaking. They might break in strange and unexpected ways.



    If you can, try this out in a scratch org first so it is easy to experiment and roll back if required.




    René Winkelmeyer has created a SFDX plugin that can automate this process for you. It will either target the highest version in the target org or you can specify a target version.



    sfdx muenzpraeger:source:api:set -a 41.0



    Reading content of package directories

    45 files have been set to API version 41.0.







    share|improve this answer




















      Your Answer







      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "459"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f229795%2fis-there-a-way-to-upgrade-api-versions-of-all-apex-classes-without-manually-upda%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      4
      down vote



      accepted










      WARNING




      First of all, I would like to say, do this only if you are certain you have sufficient unit tests to catch anything that might break. Also, make certain you back up your code. I cannot stress this strongly enough.




      You can do this pretty easily with any IDE, Salesforce DX, workbench, etc. The general process is either two or three steps.



      First, download the files you want to update the API version for. Next, use a tool to "Find and Replace in Files". All major IDEs have this feature. Replace <apiVersion>.+</apiVersion> (a regular expression match) to the desired version. Third, if your IDE doesn't automatically deploy the changes, deploy the changes back to the server.




      Force.com IDE (Search > File)



      Find Version to Replace



      Replace Version






      share|improve this answer


























        up vote
        4
        down vote



        accepted










        WARNING




        First of all, I would like to say, do this only if you are certain you have sufficient unit tests to catch anything that might break. Also, make certain you back up your code. I cannot stress this strongly enough.




        You can do this pretty easily with any IDE, Salesforce DX, workbench, etc. The general process is either two or three steps.



        First, download the files you want to update the API version for. Next, use a tool to "Find and Replace in Files". All major IDEs have this feature. Replace <apiVersion>.+</apiVersion> (a regular expression match) to the desired version. Third, if your IDE doesn't automatically deploy the changes, deploy the changes back to the server.




        Force.com IDE (Search > File)



        Find Version to Replace



        Replace Version






        share|improve this answer
























          up vote
          4
          down vote



          accepted







          up vote
          4
          down vote



          accepted






          WARNING




          First of all, I would like to say, do this only if you are certain you have sufficient unit tests to catch anything that might break. Also, make certain you back up your code. I cannot stress this strongly enough.




          You can do this pretty easily with any IDE, Salesforce DX, workbench, etc. The general process is either two or three steps.



          First, download the files you want to update the API version for. Next, use a tool to "Find and Replace in Files". All major IDEs have this feature. Replace <apiVersion>.+</apiVersion> (a regular expression match) to the desired version. Third, if your IDE doesn't automatically deploy the changes, deploy the changes back to the server.




          Force.com IDE (Search > File)



          Find Version to Replace



          Replace Version






          share|improve this answer














          WARNING




          First of all, I would like to say, do this only if you are certain you have sufficient unit tests to catch anything that might break. Also, make certain you back up your code. I cannot stress this strongly enough.




          You can do this pretty easily with any IDE, Salesforce DX, workbench, etc. The general process is either two or three steps.



          First, download the files you want to update the API version for. Next, use a tool to "Find and Replace in Files". All major IDEs have this feature. Replace <apiVersion>.+</apiVersion> (a regular expression match) to the desired version. Third, if your IDE doesn't automatically deploy the changes, deploy the changes back to the server.




          Force.com IDE (Search > File)



          Find Version to Replace



          Replace Version







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Aug 22 at 18:43

























          answered Aug 22 at 18:38









          sfdcfox

          225k10171384




          225k10171384






















              up vote
              3
              down vote













              Firstly, do heed sfdxfox's warning. It is very important to backup your metadata before embarking on such a large scale update of the api versions.



              Make sure you run all the test cases before and after to look for things breaking. They might break in strange and unexpected ways.



              If you can, try this out in a scratch org first so it is easy to experiment and roll back if required.




              René Winkelmeyer has created a SFDX plugin that can automate this process for you. It will either target the highest version in the target org or you can specify a target version.



              sfdx muenzpraeger:source:api:set -a 41.0



              Reading content of package directories

              45 files have been set to API version 41.0.







              share|improve this answer
























                up vote
                3
                down vote













                Firstly, do heed sfdxfox's warning. It is very important to backup your metadata before embarking on such a large scale update of the api versions.



                Make sure you run all the test cases before and after to look for things breaking. They might break in strange and unexpected ways.



                If you can, try this out in a scratch org first so it is easy to experiment and roll back if required.




                René Winkelmeyer has created a SFDX plugin that can automate this process for you. It will either target the highest version in the target org or you can specify a target version.



                sfdx muenzpraeger:source:api:set -a 41.0



                Reading content of package directories

                45 files have been set to API version 41.0.







                share|improve this answer






















                  up vote
                  3
                  down vote










                  up vote
                  3
                  down vote









                  Firstly, do heed sfdxfox's warning. It is very important to backup your metadata before embarking on such a large scale update of the api versions.



                  Make sure you run all the test cases before and after to look for things breaking. They might break in strange and unexpected ways.



                  If you can, try this out in a scratch org first so it is easy to experiment and roll back if required.




                  René Winkelmeyer has created a SFDX plugin that can automate this process for you. It will either target the highest version in the target org or you can specify a target version.



                  sfdx muenzpraeger:source:api:set -a 41.0



                  Reading content of package directories

                  45 files have been set to API version 41.0.







                  share|improve this answer












                  Firstly, do heed sfdxfox's warning. It is very important to backup your metadata before embarking on such a large scale update of the api versions.



                  Make sure you run all the test cases before and after to look for things breaking. They might break in strange and unexpected ways.



                  If you can, try this out in a scratch org first so it is easy to experiment and roll back if required.




                  René Winkelmeyer has created a SFDX plugin that can automate this process for you. It will either target the highest version in the target org or you can specify a target version.



                  sfdx muenzpraeger:source:api:set -a 41.0



                  Reading content of package directories

                  45 files have been set to API version 41.0.








                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Aug 22 at 21:30









                  Daniel Ballinger

                  69.3k14140363




                  69.3k14140363



























                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f229795%2fis-there-a-way-to-upgrade-api-versions-of-all-apex-classes-without-manually-upda%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Comments

                      Popular posts from this blog

                      What does second last employer means? [closed]

                      Installing NextGIS Connect into QGIS 3?

                      One-line joke