Skip to main content

Configure Code Replication

Learning Objectives

After completing this unit, you’ll be able to:

  • 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.

Developers regularly check their code into a version control system, then use a continuous integration and continuous deployment (CI/CD) tool to push a new code version to the staging instance. Depending on your company’s processes, the developer or the B2C admin transfers the new code version from the staging instance to a development and then a production instance, and then activates it.

Code replication, like data replication, has a source and a target. Data replication deals with dependencies between data objects, making 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 the new code version is version-19b. A version with that name already exists on the target instance, so B2C Commerce names the new version version-19b_01202019-1.

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.

You run both steps as a single replication process, or run them separately. Running them separately helps you identify any sources of failure. 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.

Select Activation Methods

You specify how you want to run a replication process. Your choices are:

  • Manual: The process runs when you trigger it.
  • Automatic: You schedule a single day and time when the process runs.
  • Job Step: The process runs as part of a job. We talk about jobs in the Salesforce B2C Commerce Scheduled Jobs module.

Create a Code Replication Process

Say you want to get some new code out as soon as possible, and it is after hours—a good time for this type of task. Here’s how you create a code replication process that you trigger manually.

  1. In Business Manager, click App Launcher, and select Administration | Replication | Code Replication

Business Manager Code Replication

  1. Click New. (You must be on a staging instance to see this button.)
  2. B2C Commerce creates a process ID, or you can enter the text you want.
  3. Select the Development target instance.
  4. Enter an optional description. The description helps you find the process later.
  5. For activation type, select Manual.
  6. 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.
  7. Specify what happens for these events.
    • None: No email sent
    • 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: If the process fails, B2C Commerce sends an email to the addresses. If the process succeeds or hangs, it doesn’t send an email.
    • Periodically: Sends emails at a specified interval while the process is running as well as on when it finishes.
  1. Click Next.
  2. For replication type, select Code Transfer and Activation.
  3. Click Next and review the process details. After you create the process, you can’t change it.
  4. Click Start to create the process and immediately run it.

You and the developer test the new code on the development instance. When it looks good, you replicate the same code version from the staging instance to production.

Next Steps

In this unit, you learned that code replication is fairly straightforward and requires only a unique version number. After your developer uploads code to the staging instance, you replicate it from staging to development and then production. You also learned about code replication process types and activation methods, and learned how to run a manual code replication. Next, learn about granular data replication.

Resources

Comparta sus comentarios de Trailhead en la Ayuda de Salesforce.

Nos encantaría saber más sobre su experiencia con Trailhead. Ahora puede acceder al nuevo formulario de comentarios en cualquier momento en el sitio de Ayuda de Salesforce.

Más información Continuar a Compartir comentarios