Code repository management
This blog is for an Intermediate developer who is planning to do
Salesforce backup and code management using Git. Unlike Java
Salesforce does not have a code versioning system. I am going to
demonstrate how we can use Git and Eclipse(Local code base) to have this
code management in place.
Code Repository Management
Steps to follow
Step 1 : We have a Requirement to create a new Lead source as Web2. Developer have done some changes based
upon a requirement and have marked the ticket #227 as done in project management tool? Quality Analyst(QA) gal
got this ticket #277 To test in order to test the ticket she created a Lead and set the value of Lead source as ‘Web2’ as
we were told to do so. Screenshot below
Step 2 : QA will 'retrieve' code from Sandbox using Eclipse Force.com IDE tool to do the task.
Next QA will retrieve the class from sandbox in order to do that go to eclipse click File > New > Force.com
Project
Now Type a project name then type your organization’s Username and Password and if you have the security
token you can add it too in the next field but if you don’t have the security token you can create one from your
org or you can whitelist your IP to skip the security token part. Fill the correct details then click Next.
Next step
is to
select the
metadata
you want
to
retrieve
from the
Sandbox
and then
click OK.
You can now see the metadata which you have retrieved in your local system.
Git Remote repository
Salesforce
org
3
5
6 1
2
4
Local Repository
Code sandbox serverCode remote server
Testing
Code retrieval
Deploy to Production
Push
local to
remote
Code from
Git to local
Commit
Question 3 : Describes the steps to ‘commit’ to local repository, what tools did you use?
And
Question 4 : Describes the steps to ‘push’ to remote repository,what tools did you use?
Solution : We used Eclipse to do this task as well
What we did to implement the logic:
Step 1 : First of all we have installed Git plugin for eclipse for deployment and retrieval process. To do so we have followed these
following steps:
1.1. In Eclipse(any version), Go to help > install new software.
Click on Add New button name the Repository(any) and copy and paste this url in the location field url :
http://download.eclipse.org/egit/updates
Next Install the available softwares.
1.2. Now go to Window > Perspective > Open Perspective >
Other or Click on perspective link and select Git from the
available list.
Than click Clone Repository button.
1.3. Enter your Bitbucket URL and User
Information as mentioned in below diagram.
Click Next and Finish. No need to change
other configuration in next window.
To get the BitBucket URL
First Register to Bitbucket create a Repository public/private your choice. On Overview page
https://bitbucket.org/dashboard/overview, look for your repository information.
Mouse hover will give you Repository URL.You can use this URL in Previous step.
1.4. You can see your Bitbucket Repository now in eclipse.
1.5. Now you may want to import the project so you can work on the source code.
Click Windows > Open Perspective > Resource
Then click File >Import > Git > Projects from Git > Existing local repository > Select a Git Repository > Import as General
Project > Next > Finish
1. The code should then appear in your ‘Project Explorer’ window as a normal project
2. Now make changes to your file as you want.
3. Look at ‘Git Staging’ view to see your changed files and Click ‘Commit and Push‘ and in case if you want to commit it
only for your local repository then press the commit button.
Question 5 : Describes the steps taken to deploy code to ‘Salesforce – Production; what tools did you use?
Solution : We used Eclipse Force.com IDE to deploy the code in sandbox. To deploy the code in production right click on
the class or the code which you need to deploy than select Force.com > Deploy to server
After clicking on deploy to server you will be asked for your production credentials.
After filling the details click on the Next button below then you will be asked for Archive Options than either you can select
a destination folder in which you want to store the errors or success messages which occurred or if you are confident
enough than you can skip that part and uncheck the destination field checkbox then click next.
Than it will ask you to validate the selected classes before deployment or you can take a risk and directly click on the next
button below to deploy the code.
And if your confidence was right than you get a success message.
And you are done you have successfully deployed the metadata
in the production.
THANK YOU

Code repository management

  • 1.
  • 2.
    This blog isfor an Intermediate developer who is planning to do Salesforce backup and code management using Git. Unlike Java Salesforce does not have a code versioning system. I am going to demonstrate how we can use Git and Eclipse(Local code base) to have this code management in place. Code Repository Management
  • 3.
    Steps to follow Step1 : We have a Requirement to create a new Lead source as Web2. Developer have done some changes based upon a requirement and have marked the ticket #227 as done in project management tool? Quality Analyst(QA) gal got this ticket #277 To test in order to test the ticket she created a Lead and set the value of Lead source as ‘Web2’ as we were told to do so. Screenshot below
  • 4.
    Step 2 :QA will 'retrieve' code from Sandbox using Eclipse Force.com IDE tool to do the task. Next QA will retrieve the class from sandbox in order to do that go to eclipse click File > New > Force.com Project Now Type a project name then type your organization’s Username and Password and if you have the security token you can add it too in the next field but if you don’t have the security token you can create one from your org or you can whitelist your IP to skip the security token part. Fill the correct details then click Next.
  • 5.
    Next step is to selectthe metadata you want to retrieve from the Sandbox and then click OK.
  • 6.
    You can nowsee the metadata which you have retrieved in your local system. Git Remote repository Salesforce org 3 5 6 1 2 4 Local Repository Code sandbox serverCode remote server Testing Code retrieval Deploy to Production Push local to remote Code from Git to local Commit
  • 7.
    Question 3 :Describes the steps to ‘commit’ to local repository, what tools did you use? And Question 4 : Describes the steps to ‘push’ to remote repository,what tools did you use? Solution : We used Eclipse to do this task as well What we did to implement the logic: Step 1 : First of all we have installed Git plugin for eclipse for deployment and retrieval process. To do so we have followed these following steps: 1.1. In Eclipse(any version), Go to help > install new software. Click on Add New button name the Repository(any) and copy and paste this url in the location field url : http://download.eclipse.org/egit/updates
  • 8.
    Next Install theavailable softwares.
  • 9.
    1.2. Now goto Window > Perspective > Open Perspective > Other or Click on perspective link and select Git from the available list.
  • 10.
    Than click CloneRepository button. 1.3. Enter your Bitbucket URL and User Information as mentioned in below diagram. Click Next and Finish. No need to change other configuration in next window.
  • 11.
    To get theBitBucket URL First Register to Bitbucket create a Repository public/private your choice. On Overview page https://bitbucket.org/dashboard/overview, look for your repository information.
  • 12.
    Mouse hover willgive you Repository URL.You can use this URL in Previous step. 1.4. You can see your Bitbucket Repository now in eclipse.
  • 13.
    1.5. Now youmay want to import the project so you can work on the source code. Click Windows > Open Perspective > Resource Then click File >Import > Git > Projects from Git > Existing local repository > Select a Git Repository > Import as General Project > Next > Finish 1. The code should then appear in your ‘Project Explorer’ window as a normal project 2. Now make changes to your file as you want. 3. Look at ‘Git Staging’ view to see your changed files and Click ‘Commit and Push‘ and in case if you want to commit it only for your local repository then press the commit button.
  • 14.
    Question 5 :Describes the steps taken to deploy code to ‘Salesforce – Production; what tools did you use? Solution : We used Eclipse Force.com IDE to deploy the code in sandbox. To deploy the code in production right click on the class or the code which you need to deploy than select Force.com > Deploy to server
  • 15.
    After clicking ondeploy to server you will be asked for your production credentials.
  • 16.
    After filling thedetails click on the Next button below then you will be asked for Archive Options than either you can select a destination folder in which you want to store the errors or success messages which occurred or if you are confident enough than you can skip that part and uncheck the destination field checkbox then click next.
  • 17.
    Than it willask you to validate the selected classes before deployment or you can take a risk and directly click on the next button below to deploy the code.
  • 18.
    And if yourconfidence was right than you get a success message. And you are done you have successfully deployed the metadata in the production.
  • 19.