Salesforce B2C Commerce Cloud – Production And Staging Deployments

Salesforce B2C Commerce Cloud – Production And Staging Deployments

Sharing is caring!

To ensure successful development, Salesforce developers need to work on multiple aspects while reducing code failure risks and maintaining faster implementation and development performance.

A typical development process requires design, testing, and installation before being deployed in a production environment. During this development cycle, developers can migrate multiple times to fully synchronize development organizations or transfer changes made during the development phase to production, which is what we call Salesforce deployment.

In this blog, we will take you through a step-by-step process of implementing code In the Staging And Production stages. But before that, let’s understand these two final processes, staging, and production, individually, which an application undergoes before the software/application goes live. 

What Is Staging?

A staging environment is a server environment that allows websites and software applications to be tested under realistic conditions. A staging environment consists of components similar to the production variant that provides the final release. Staging is the final step before the application goes into production. This ensures that the application meets business expectations. 

What Is Production?

The latest version of a software, product, or update is delivered to the intended user in a production environment. Think of this as the final stage of production. It is an environment where end-users can see, experience, and interact with new products. All tests are completed before this point, and all errors are eliminated.

Here, we’ve formulated the perfect guide for you to learn how to deploy Code In Staging And Production stages.

How To Deploy Code In Staging And Production Stage:

Deploying a code into staging includes two-factor authentication, staging, and client certification. With the key provided by Salesforce, the customer can generate a certificate and sign in.

Note: You can also generate multiple client certificates with different expiration dates.

Select the latest code version to create a storefront. Then select Administration > Site Development > Code Deployment from the drop-down menu. A site’s active performance can be chosen from a version directory. The functional version includes all templates, pipelines, scripts, and pictures.

You can also change the storefront to a previously used version. Or create a new app with a newer version. Only staging, development, and sandbox instances are allowed to upload code in the live version. WebDAV-based code uploads made directly in the current version are rejected in the production version. Only inactive versions of code can be uploaded to Production.

You can transfer code from one version to another. However, the ideal method is to upload the code to an inactive version of the staging instance, then copy it to the development or production instance. Typically, the live version of code is copied from staging to production or development targets using code replication.

To complete the procedure, you will need the B2C Commerce Certificate.zip file. Salesforce usually provides a certificate.zip and can also request Salesforce customer requests.

Certificate.zip file contains these following files:-

  • .key
  • .srl
  • .crt
  • .txt

indicates your instance or company name. .srl contains the serial number, .txt contains the passphrase used to access the key. The files in Certificate.zip are susceptible. The best practice is to share the file with trusted employees only within your organization.

  1. Install OpenSSL on your computer Window. If you are using macOS, then no need to install OpenSSL. OpenSSL is included in the Operating System.
  2. Download OpenSSL from :  http://slproweb.com/products/Win32OpenSSL.html  
  3. Accept the default installation instructions. OpenSSL is installed to C:\OpenSSL.
  4. Create a certificate request.
  1. Unzip the Certificate.zip file.
    1. In Windows, unzip the contents of the file into C:\OpenSSL\bin. 
    2. In macOS or UNIX OS, you can use any directory.
  2. Go to the directory where you unzip the contents of certificate.zip.
  1. Now run OpenSSL(Application) as Administrator.
  1. Enter the following command to create a request:

“openssl > req -new -sha256 -newkey rsa:2048 -nodes -out .req -keyout .key”

  1. A key length of more than 1024 bits is necessary for Salesforce B2C commerce to support client certificates.
  2. is the user for whom this key is intended. It is recommended that

Must be the same as the corresponding Business Manager. For example:

If the B2C commerce instance username is “jerrymcguire@cloudanalogy.com,” then use “jerrymcguire@cloudanalogy.com” for certificate users. Don’t use generic names.

The result for this step is similar to the following:

1.3 This Challenge Password and Optional Company name is optional and recommended that the challenge password be never used.

1.4 This will create two files in certificate.zip named.req and .key

  1. Now you have to sign the .req with your certificate.

2.1 Enter the following command : 

Openssl > x509 -CA .crt -CAkey .key -CAserial .srl -req -in .req -out .pem -days

  1. is the number to validate the client certificate for.
  2. is the unique identifier given in the certiifcate.zip file provided by Salesforce.
  1. Now enter the passphrase contained in .txt in the certificate.zip file to sign the certificate.
  2. After entering the passphrase, you’ll get file .pem in the same directory where the content of the certificate.zip file is stored.
  1. In pkcs12 format, export the certificate and client information.

3.1 Enter the following command:

Openssl > pkcs12 -export -in .pem -inkey .key -certfile .crt -name “” -out .p12

  1. Salesforce provides the unique identifier.
  2. client certificate user name.

3.2 Specify the Export password.

3.3 And provide the Export password to those who use this certificate.

3.4This will create a .pk12 file to connect to staging with UX Studio(Eclipse).

4. Create a server connection in UX Studio to connect to a staging instance.

4.1 Open Eclipse, then Click File -> New -> Digital Server Connection.

4.2 Enter the new URL as cert.staging…demandware.net.

4.3 Click the Use Certificate Authentication check box.

4.4 Browse to the pk12 file and click Select.

4.5 Enter the export password for the .p12 file.

4.6 Deploy the code in the older or a newer version according to the need. 

4.7 Click finish, and now upload the code into the staging.

Conclusion 

A successful development process comprises an organized pre-production environment. Having the right tools and best practices to manage the integration and deployment of your code will ensure your team always produces reliable code.

Deploying code is an essential step in deployment and production. This is where technology and business come together to create responsible apps for their users. Unfortunately, this process can be confusing the first time you do it. However, through a step-by-step process, effective methods of deploying code into stage and production can make your application presentable for the business and intended users.

Looking to hire the best Salesforce consulting services to make the most out of your Salesforce investment? Whether you’re new to the Salesforce ecosystem or looking to optimize your existing platform, hiring our best Salesforce consulting services would take your business to the next level. With Cloud Analogy as your Salesforce Consulting partner, you can stay on top of the latest innovations throughout your growth journey.

IMG-20180211-WA0001 (1)

Somya Tyagi

Project Manager
Somya Tyagi is a highly skilled Project Manager who has successfully delivered hundreds of CRM projects in the last few years. She is a Scrum Master of repute who is passionate about agility and helping companies make the transition from traditional project management/development to agile. Somya is always open to assist other teams in understanding project requirements so that collaboration can happen in the best possible ways in an environment conducive for the business. She is a top-performer and motivator who has the added advantage of technology as leverage to achieve timely results.

× How can I help you?