Configure Code Replication
- List the four code replication process types.
- Describe how to transfer a new code version from a sandbox to a development instance.
- List the code replication activation methods.
- List three steps in a manual code replication process.
Linda Rosenberg, Cloud Kicks' new administrator, learns that the site’s developer is ready to roll out some awesome storefront features. The developer already uploaded the code from a sandbox instance to staging, and the QA testing went well. Now it’s Linda’s turn. With code replication, she can transfer the new code version from the staging instance to a development and then a production instance, and then activate it.
Code replication, like data replication, has a source and a target. Data replication, however, deals with dependencies between data objects, which can make things complicated. Code replication is straightforward. When you replicate a code version, Salesforce B2C Commerce assigns the version on the target instance the same name as the source version on staging. If the name already exists, it appends a timestamp and index number to the name.
For example, the name of Cloud Kicks’ new code version is version-19b. A version with that name already exists on the target instance, so B2C Commerce names the new version
Like data replication, code replication is a two-step process.
- B2C Commerce transfers a code version from staging to the target instance.
- It activates the code on the target instance.
Linda can run both steps as a single replication process, or run them separately. Running them separately can help her identify any sources of failure if it occurs. All code replication processes run on the staging instance, even code activation and undo, which only affect the target instance.
There are four types of code replication processes.
- Code Transfer: B2C Commerce transfers the selected code version on the source instance to the target instance, but it doesn’t activate it.
- Code Transfer and Activation: B2C Commerce transfers the selected code version on the source instance to the target instance and then activates it.
- Code Activation: This process is available only after a successful code transfer process. Activation makes the transferred code version the active version on the target instance. If the new code version is already active, nothing happens. If it doesn’t exist on the target instance, the replication fails.
- Undo: This process is available only after a successful code transfer and activation or code activation replication process. It reverts the active code version on the target instance to the version that was active before the last code replication process. If the version you want to revert is no longer active, nothing happens. If it no longer exists on the target instance, or if the previously active code version no longer exists, the replication process fails.
Linda can specify how she wants to run a replication process. Her choices are:
- Manual: The process runs when she triggers it.
- Automatic: She schedules a single day and time when the process runs.
- Recurring: She schedules a recurring time when the process runs:
- Job Step: The process is available to run as part of a job. We talk about jobs in the Salesforce B2C Commerce Scheduled Jobs module.
Linda wants to get the new code out as soon as possible, and it’s after hours—a good time for this type of task. Here’s how she creates a code replication process that she can trigger manually.
- Open Business Manager.
- Select Administration > Replication > Code Replication.
- Click New. (You must be on a staging instance to see this button.)
- B2C Commerce creates a process ID, or you can enter the text you want.
- Select the Development target instance.
- Enter an optional description. This can help you find it later.
- For activation type, select Manual.
- Select a notification email trigger and enter multiple target email addresses separated by commas. The email contains the start and end time of the process, target system, replication type, and replication tasks. If the process fails, the email notification includes an error code. Each process in a recurring series sends its own notification.
- Specify what happens for these events.
- Process ends: B2C Commerce sends an email to the addresses when the process ends, whether it succeeds or fails. If it hangs, it doesn’t send an email.
- Process fails: B2C Commerce sends an email to the addresses if the process fails. If the process succeeds or hangs, it doesn’t send an email.
- Click Next.
- For replication type, select Code Transfer and Activation.
- Click Next and review the process details. Once you create the process, you can’t change it.
- Click Start to create the process and immediately run it.
Linda and the developer test the new code on the development instance. When it looks good, she replicates the same code version from the staging instance to production. Now Cloud Kick’s shoppers can use the awesome new features!
In this unit, Linda learned that code replication is fairly straightforward and requires only a unique version number. After her developer uploaded code to the staging instance, she replicated it from staging to development and then production. She also learned about code replication process types and activation methods. She ran a manual code replication that pushed great new features out to the storefront.