backup data from a salesforce org to another
TRANSCRIPT
Salesforce Tutorial
How to backup your data from one Org to another
David Boukhors – Salesforce Exprt
Prerequesites• Install force.com IDE (w/ Eclipse) :
– https://developer.salesforce.com/page/Force.com_IDE_In
stallation
• Download and install Talend Open Studio for Data
Integration (Free):
– http://fr.talend.com/download/talend-open-studio?qt-
product_tos_download=3#qt-product_tos_download
David Boukhors - Expert Salesforce 2
2 Org• The Org you want to backup is called Org A
• The Org which will serve as a backup
environment is called Org B
• At the beginning Org B is completely empty
• In this tutorial we’ll copy all accounts and
contacts from Org A to Org B
David Boukhors - Expert Salesforce 3
First Step
• First, we need to copy all custom fields for
Account and Contact objects from Org A to
Org B
• This can be achieved using Force.com IDE
David Boukhors - Expert Salesforce 4
How to get your security token?• Go to Your Name > Settings and
select Personal > Reset my
security token
• You will receive your security
token by mail
• You’ll need it for Org A and Org B
David Boukhors - Expert Salesforce 5
• Open Eclipse, and choose
File>New>Force.com IDE project
David Boukhors - Expert Salesforce 6
• Enter project Name
: Backup Data
• Your username,
password and
security token for
Org A
• Then click Next
David Boukhors - Expert Salesforce 7
Select « Selected metadata components then click on Choose…
David Boukhors - Expert Salesforce 8
• Select Account
and Contact
object under
object – standard
category
• Click OK
• Then click Finish
David Boukhors - Expert Salesforce 9
• Inside Package
Explorer View, on
the left pane, right
click on Account
• Select Force.com
> Deploy to Server
David Boukhors - Expert Salesforce 10
• Now enter Org B credentials and click on Next
• Select a destination archive and click on Next
David Boukhors - Expert Salesforce 11
• Click on
Validate
Deployment
to test your
deployment
David Boukhors - Expert Salesforce 12
If this is a success, click on Next to really deploy the configuration to Org B
David Boukhors - Expert Salesforce 13
Just click on Finish
David Boukhors - Expert Salesforce 14
• In Org B, you can go to Configuration >
Deploy > Deployment status and check the
deployment status
• Repeat the same steps for Contact ObjectDavid Boukhors - Expert Salesforce 15
• You must go to Salesforce OrgB environment
and select Setup > Build > Customize >
Account > Field
David Boukhors - Expert Salesforce 16
• You’ll see a list of custom fields. One by one, click on each
field and select « Set Field-Level Security ». By default all
new fields are hidden. You must set them to visible.
• Just click on the visible checkbox to make the field visible
to all profile.
• Repeat the steps for all Account and Contact custom fields
David Boukhors - Expert Salesforce 17
• You also need to create a custom field on
Account and Contact objects to store the
external Id.
David Boukhors - Expert Salesforce 18
Now, open Talend Open Studio, select the
Integration perspective, and create a new job
David Boukhors - Expert Salesforce 19
Enter a job name (without space) and click on FinishDavid Boukhors - Expert Salesforce 20
In left panel, go under metadata > Salesforce and
select Create a salesforce connexion
David Boukhors - Expert Salesforce 21
• Create a connexion for
Org A, and another one
for Org B
• You just need user name
and password + token
for each org
David Boukhors - Expert Salesforce 22
• The security token must be appended to the
password
• Test the authentication and click on Finish
• You should now have two Salesforce
connexions, called OrgA and OrgB
David Boukhors - Expert Salesforce 23
• Right click on OrgA connexion and choose Retrieve Salesforce
modules. Then select Account and Contact and click on Finish
• Repeat for OrgB
David Boukhors - Expert Salesforce 24
• Drag and drop Account object under OrgA Connexion
on the middle panel
Select tSalesforceInput and click OKDavid Boukhors - Expert Salesforce 25
• Drag and drop Account object under OrgB Connexion
on the middle panel
Select tSalesforceOutput and click OK
David Boukhors - Expert Salesforce 26
• In the right pane, go to
transformation category and
drag and drop a tMap
component onto the middle
panel between the other two
components.
David Boukhors - Expert Salesforce 27
• Right click on first component and select
Row>Main to connect the two first
component. Then right click on the tMap
component and select Row>New Output, and
name the connexion Row2David Boukhors - Expert Salesforce 28
• Double click on tMap component and select
AutoMap.
David Boukhors - Expert Salesforce 29
• On the right pane, you’ll need to delete the following lines:
• row1.Id, row1.IsDeleted, row1.MasterRecordId, row1.ParentId, row1.Sic,
row1.OwnerId, row1.CreatedDate, row1.CreatedById,
row1.LastModifiedDate, row1.LastModifiedById,
row1.SystemModstamp, row1.LastActivityDate, row1.Jigsaw,
row1.JigsawCompanyId, row1.CleanStatus, row1.DandbCompanyId and
other Id or system fields you don’t need.
• Use the delete button on the bottom-right panel. Then click OK when
doneDavid Boukhors - Expert Salesforce 30
Drag and drop the Id field from left pane to the
External Id Field on the right pane (you created
this field on slide 18)
David Boukhors - Expert Salesforce 31
• Click on Apply, propagate the Change, and
OK.
David Boukhors - Expert Salesforce 32
Click on the right component (Account
SalesforceOutput) and uncheck the first two
settings in Advanced Settings section. The flow
must not stop on error.
David Boukhors - Expert Salesforce 33
• Add a File>Write>tFileOutputExcel from right
panel to the middle panel.
• In the middle panel, right click on third
component and select Row>reject to connect
to the component you just added.
David Boukhors - Expert Salesforce 34
• In the fFileOutputExcel component settings,
select the target file and check the include
headers box.
David Boukhors - Expert Salesforce 35
• Now click on the run icon on the top bar and
wait for the result. You must wait until the end
to if you want to use the error file. This file is
written to the file system only if you run the
process until the end.
David Boukhors - Expert Salesforce 36
• If you have errors, it is mostly due to read only
fields you try to update.
– Review the error file
– Correct the tMap component accordingly
– Propagate the change
– Re-run the job
David Boukhors - Expert Salesforce 37
• Now visit your salesforce OrgB environment
and check that you can see all the accounts
you just uploaded from OrgA. If some fields
are missing, correct the job. But you’ll need to
put the third component on Upsert mode
before running the job again.
David Boukhors - Expert Salesforce 38
• Now, you can create another job for the
Contact import. All steps are the same, except
we’ll need to add a lookup based on the
external Account Id you created on slide 18.
David Boukhors - Expert Salesforce 39
• Let’s say you’ve added the Contact
tSalesforceInput component from OrgA and
the Contact tSalesforceOutput component
from OrgB and the tMap
David Boukhors - Expert Salesforce 40
Drag and drop Account object from OrgB
connection and add a tSalesforceInput to retrieve
current Account Id in OrgB. Connect this new
component to tMap component (right
click>Row>Main)
David Boukhors - Expert Salesforce 41
• Double click on the tMap component, and
click on Automap. Then drag and drop
Account Id from the first bloc of left pane
(meaning Contact mapping from OrgA) with
the External Id on the second bloc of left pane
(meaning Account mapping from OrgB)
David Boukhors - Expert Salesforce 42
• On the right pane, proceed as previously.
Remove all system field. Update the
expression for AccountId field to row2.Id
(meaning the Account Id calculated on OrgB
through the matching with External Account
Id)
David Boukhors - Expert Salesforce 43
• Connect the Contact(tSalesforceOuput)
component with the tFileOutputExcel
component with a Row>Reject connexion and
launch the Job
• There you are!
David Boukhors - Expert Salesforce 44