How to Creating a Patch Organization in Salesforce?
How to Creating a Patch Organization
In order to create a patch, you need to generate a new patch development organization.
To create a patch version:
- From Setup, enter Packages in the Quick Find box, then select Packages.
- Click the name of your managed package.
- On the Patch Organization tab, click New.
- Select the package version that you want to create a patch for in the Patching Major Release dropdown. The release type must be Managed – Released.
- Enter a username for a login to your patch org.
- Enter an email address associated with your login.
- Click Save.
Patch Organization Details
A patch version enables a developer to change the functionality of existing components in a managed package. Subscribers experience no visible changes to the package. Patches are minor upgrades to a Managed – Released package and only used for fixing bugs or other errors.
Patch versions can only be created for Major Releases. Subscribers can receive patch upgrades just like any other package version. However, you can also distribute a patch by using push upgrades.
When you create a patch, the patch number on a package’s Version Number increments by one. For example, suppose that you release a package with the version number 2.0. When you release a patch, the number changes to 2.0.1. This value can’t be changed manually.
Patch Development Organizations
Every patch is developed in a patch development organization, which is the organization where patch versions are developed, maintained, and uploaded. To start developing a patch, create a patch development organization. See Create and Upload Patches. Patch development organizations are necessary to permit developers to change existing components without causing incompatibilities between existing subscriber installations.
A patch development organization can upload an unlimited number of patches. Only one patch development organization can exist per major release of your package. A patch development organization for a package with a version number of 4.2 can only work on patches such as 4.2.1, 4.2.2, 4.2.3, and so on. It won’t work on version 4.1 or 4.3.
Integrating Patch Development
The following diagram illustrates the workflow of creating a patch and integrating any work into future versions:
Patch Development Workflow
After version 2.0 is released, the developer creates a patch. The package version number in the patch development organization starts at 2.0.1. As the main development organization moves towards a released version of 3.0, a second patch is created for 2.0.2. Finally, the developer merges the changes between the main development organization, and the patch development organization, and releases the package as version 3.0.
If you are developing your packages using the Force.com IDE, you can take advantage of revision control systems in Eclipse to compare and merge different project branches.
Salesforce recommends using the Subversion plug-in. To install Subversion for the IDE:
- Go to http://subclipse.tigris.org to get the latest Eclipse Update Site URL compatible with your version of Eclipse.
- In the Lightning Platform IDE, navigate to Help | Software Updates, and select the Available Software tab. Click Add Site, and enter the URL from the previous step.
- Select the new site and click Finish to fetch the latest version of the Subclipse plug-in. Select the required Subclipse plug-in from the list returned from the site.
- Click Next, accept the terms and click Next again.
- To begin the installation, click Finish and then Install All. Restart Eclipse after the installation completes.
You have now linked your Lightning Platform IDE environment to Subclipse. The next step is to connect your repository to the environment:
- Open the SVN Repository Exploring perspective in the IDE. Locate the SVN Repositories view.
- Use the Add SVN Repository icon on the far right to configure Subclipse to access the local repository. The URL to access your repository locally is file:///svn_repos.
The subversion repository tracks changes made to stored projects. Because working with patches involves two different branches, the main development organization, and a patch development organization, you combine your changes for a future release. To view the different versions of your package:
- Open the Project Explorer perspective.
- Navigate to a file in your main development project that you want to compare, and use the context menu to select Compare With… | Branch/Tag…
- In the Compare to the field, select the patch version of the file.
- Click Graphical, then click OK.
The changes between the main development organization’s file and the file stored in the patch development organization are highlighted. You can use this view to merge any differences between the two projects.
For more information on using the Lightning Platform IDE, see the Platform Developer’s Guide.