In this concluding blog on BitBucket integration in Salesforce, we’ll proceed with the final step of pushing changes to the Bitbucket Repository for the ultimate deployment. The steps of creating the Apex class and LWC component for final deployment were covered in the previous blog.

So, Let’s get started with the final process without further delay.

Adding Repository variable in Bitbucket repository

After you have configured the BitBucket Pipeline file as shown in the previous blog, Click on Source control from the left sidebar.

Click on Source control

Generally Vs code automatically opens the repository available in the parent folder

If It does not open automatically, you will get a text like “A Git Repository found in the parent folder of the workspace or the open file” . Click on Open Repository.

Click on Open Repository
  • Click on bit bucket repo1.
  • Here you see all the changes in the repository
  • Enter any comment in the Message field. We are writing “Created lwc, apex with test class and yaml file configuration”.
  • Click on the drop-down on the right side of the commit button. Click on commit and push.
commit and push

It will push all the changes of bit bucket repo1 in the repository of Bitbucket. You can verify it by opening the bitbucket repository. It looks like below:

bitbucket repository

Open your Bitbucket repository left side menu and click on Repository settings. Scroll the left menu bar and click on the Repository variable.

Repository variable

Now, Add these value in Name and Value fields respectively andthe check secured check box for every value:

Name

  1. USERNAME_PROD
  2. USERNAME_UAT
  3. CONSUMER_KEY_UAT
  4. CONSUMER_KEY_PROD
  5. DECRYPTION_KEY_UAT
  6. DECRYPTION_KEY_PROD
  7. DECRYPTION_IV_PROD
  8. DECRYPTION_IV_UAT

 Value

  1. PROD username
  2. UAT Sandbox username
  3. UAT’s Consumer Key of ConnecTed app
  4. Production’s Consumer Key of Connected app
  5. Key generated to encrypt server.key for UAT
  6. Key generated to encrypt server.key for PROD
  7. Iv(initialization vector) generated to encrypt server.key for PRO
  8. Iv(initialization vector) generated to encrypt server.key for UAT

After adding all values it looks like below

All Repo Variaable

Validate and Deploy Apex and LWC from Dev to UAT:

  • We have created two Branches for UAT, sub_uat and main_uat.
  • If we want to validate changes in UAT then we should merge Dev Branch to sub_uat.
  • After successfully validating the changes in UAT, we will deploy those changes in UAT by merging the sub_uat branch into main_uat.

Validate changes in UAT:

  • Open your Bitbucket repo1 Repository.
  • Click on Pull request in the left side menu bar. Click on Create pull request.
  • For Source Branch choose Dev and for Destination Branch choose sub_uat
  • Enter Title Dev To sub_uat.

You can add a Description and also add a reviewer who will review your code or changes.

Bit bucket repo1 Repository

Click on Create Pull Request.

A new Pull Request is created because here we don’t have any reviewers so we have to approve and merge the code by clicking on Merge.

Create Pull Request

When Merge is completed pipeline will run automatically.

  • Click on Pipeline.
  • Click on Merged in Dev (pull request #1) Dev To sub_uat you can see it will do things one by one.
Click on Merged in Dev

After some time validation will be successful.

validation
  • Now log into the Uat environment and from Setup>Deployment status.
  • Click on Deployment status and in the Succeeded section you will see deployment with Validate: succeeded status.
succeeded status

Deploy the changes in UAT:

  • Open your Bit bucket repo1 Repository.
  • Click on Pull request in the left side menu baR. Click on Create pull request.
  • For Source Branch choose sub_uat and for Destination Branch choose main_uat.
  • Enter Title sub_uat To main_uat.

You can add a Description and also add a reviewer who will review your code or changes.

  • Click on Create Pull Request.
  • A new Pull Request is created because here we don’t have any reviewers so we have to approve and merge the code by clicking on Merge.

When Merge is completed pipeline will run automatically.

  • Click on Pipeline.
  • Click on Merged in Dev (pull request #2) sub_uat To main_uat you can see it will do things one by one.

After some time Deployment will be successful.

Deployment will be successful
  • Now log into Uat environment and from Setup>Deployment status.
  • Click on Deployment status and in Succeeded section you will see deployment with Deploy: succeeded status.
41 2

Now Apex class “firstApexClass” and its test class will be available in Uat. You can verify it from setup>Apex classes and there you will see your deployed apex classes.

deployed apex classes

For verify LWC from Setup>Custom Code>Lightning Components. And there you will find your deployed LWC.

deployed LWC

Finally, Validate and Deploy in the Production environment:

  • We have created two Branches for Production, sub_main and main.
  • If we want to validate changes in Production then we should merge main_uat Branch to sub_main.
  • After successfully validating the changes in Production to deploy changes in Production we will merge the sub_main branch into the main.

Validate changes in Production:

  • Open your Bit bucket repo1 Repository.
  • Click on Pull request in the left side menu bar. Click on Create pull request.
  • For Source Branch choose main_uat and for Destination Branch choose sub_main
  • Enter Title main_uat To sub_main.

You can add a Description and also add a reviewer who will review your code or changes.

  • A New Pull Request is created because here we don’t have any reviewers so we have to approve and merge the code by clicking on Merge.
  • When Merge is completed pipeline will run automatically. Click on Pipeline.
Validate changes in Production
  • Click on Merged in Dev (pull request #3) main_uat To sub_main you can see it will do things one by one.
  • After some time Validation will be successful.
After some time Validation will be successful
  • Now log into the Production environment and from Setup>Deployment status.
  • Click on Deployment status and in the Succeeded section you will see deployment with Validate: succeeded status.
41 3

Deploy changes in Production :

  • Open your Bit bucket repo1 Repository.
  • Click on Pull request in left side menu bar . Click on Create pull request.
  • For Source Branch choose sub_main and for Destination Branch choose main
  • Enter Title sub_main To main.
  • You can add Description and also add reviewer who will review your code or changes.
  • Click on Create Pull Request.
  • New Pull Request is created because here we don’t have any reviewer so we have to approve and merge the code by clicking on Merge.
  • When Merge is completed pipeline will run automatically. Click on Pipeline.
Click on Pipeline
  • Click on Merged in Dev (pull request #4) sub_main To main you can see it will do things one by one.
  • After some time Deployment will be successful.
  • Now log into the Production environment and from Setup>Deployment status.
  • Click on Deployment status and in the Succeeded section you will see deployment with Deploy: succeeded status.
  • Now Apex class “firstApexClass” and its test class will be available in Uat. You can verify it from setup>Apex classes and there you will see your deployed Apex classes.
verify it from setup>Apex classes

For verify LWC from Setup>Custom Code>Lightning Components. And there you will find your deployed LWC.

verify LWC

Conclusion:

Bitbucket is a powerful and flexible tool that can help you streamline your Salesforce development workflow and deliver better code faster. Compared to other version control tools such as GitLab or GitHub, Bitbucket offers more features and integrations for Salesforce developers, such as native support for Salesforce DX, Salesforce CLI, SFDX Scanner, and more.

Try out the solution in your org and feel free to contact us for any Salesforce Development solution!

Related Articles
Please Make Blog Banner How to Create an Agentforce Enabled Scratch Org in Salesforce 100 1

Setting up an Agentforce-enabled scratch org is the most important step for developers who want to experiment with AI features such as Prompt Builder and Einstein GPT. Whether you’re developing the next generation CRM software or experimenting with how generative AI may improve user experience, a scratch org equipped with Agentforce is your playground. Follow […]

Read More
Step-by-Step Guide to Enhance Your LWC Development Workflow with the Logger API

Are you looking to streamline your LWC development workflow but confused about how to do it? Then you are in the right place. The Salesforce Logger API is a powerful tool that helps you monitor, debug, and improve code quality in real time.  This step-by-step guide walks you through how to set it up and […]

Read More
Enhancing Your Salesforce Experience with a Custom Activity Component

In today’s fast-paced business landscape, productivity hinges on streamlined workflows and intuitive interfaces. While Salesforce offers robust activity tracking capabilities, sometimes the standard components fall short of specific organizational needs.  That’s where a Custom Activity Component comes in—designed to tailor your activity management experience, boost user efficiency, and provide deeper insights into customer interactions. In […]

Read More
Step-by-Step Guide to Integrating Salesforce Doc-Gen with eSigning Tools

In today’s fast-paced digital landscape, streamlining document workflows is no longer a luxury—it’s a necessity.  Integrating a document generation app, like Docs Made Easy, with an eSigning tool, helps businesses automate the entire document lifecycle—from creation to signature—saving time, reducing errors, and boosting productivity. In this guide, we’ll walk you through the key steps, tools, […]

Read More
How to Build a Real Time Chat Application Using LWC and Models API

The Models API plays a significant role in providing access to and facilitating interaction with large language models (LLMs) from various Salesforce partners such as Anthropic, Google, and OpenAI. It enables applications to leverage these models for various tasks, including text generation and other AI-powered capabilities. As a user, you can configure any Salesforce-enabled model […]

Read More
How to Integrate Salesforce Data Cloud with Amazon Redshift

Companies can finally connect Amazon Redshift to Salesforce Data Cloud without using the ordinary username & password authentication systems ever since its collaboration with AWS has happened. Business owners no longer have to be concerned about managing static credentials or breaching data security. By leveraging Salesforce IDP, companies can easily access their data lakehouse in […]

Read More
Our Location worldwide
Indian Flag India
3rd Floor, A-10, Pegasus Tower, Sector 68, Noida, Uttar Pradesh 201301 +91-1203117884
United States of America Flag USA
333 West Brown Deer Road Unit G – 366 Milwaukee WI, USA 53217 +1(262) 310-7818
United Kingdom Flag UK
7 Bell Yard, London, WC2A 2JR +44 20 3239 9428
Canada Canada
HIC Global Solutions INC
43 Lafferty Lane, Richmond Hill, L4C 3N8, CA +1(262) 310-7818