44
Salesforce Tutorial How to backup your data from one Org to another David Boukhors – Salesforce Exprt

Backup data from a Salesforce Org to Another

Embed Size (px)

Citation preview

Page 1: Backup data from a Salesforce Org to Another

Salesforce Tutorial

How to backup your data from one Org to another

David Boukhors – Salesforce Exprt

Page 2: Backup data from a Salesforce Org to Another

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

Page 3: Backup data from a Salesforce Org to Another

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

Page 4: Backup data from a Salesforce Org to Another

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

Page 5: Backup data from a Salesforce Org to Another

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

Page 6: Backup data from a Salesforce Org to Another

• Open Eclipse, and choose

File>New>Force.com IDE project

David Boukhors - Expert Salesforce 6

Page 7: Backup data from a Salesforce Org to Another

• Enter project Name

: Backup Data

• Your username,

password and

security token for

Org A

• Then click Next

David Boukhors - Expert Salesforce 7

Page 8: Backup data from a Salesforce Org to Another

Select « Selected metadata components then click on Choose…

David Boukhors - Expert Salesforce 8

Page 9: Backup data from a Salesforce Org to Another

• Select Account

and Contact

object under

object – standard

category

• Click OK

• Then click Finish

David Boukhors - Expert Salesforce 9

Page 10: Backup data from a Salesforce Org to Another

• Inside Package

Explorer View, on

the left pane, right

click on Account

• Select Force.com

> Deploy to Server

David Boukhors - Expert Salesforce 10

Page 11: Backup data from a Salesforce Org to Another

• Now enter Org B credentials and click on Next

• Select a destination archive and click on Next

David Boukhors - Expert Salesforce 11

Page 12: Backup data from a Salesforce Org to Another

• Click on

Validate

Deployment

to test your

deployment

David Boukhors - Expert Salesforce 12

Page 13: Backup data from a Salesforce Org to Another

If this is a success, click on Next to really deploy the configuration to Org B

David Boukhors - Expert Salesforce 13

Page 14: Backup data from a Salesforce Org to Another

Just click on Finish

David Boukhors - Expert Salesforce 14

Page 15: Backup data from a Salesforce Org to Another

• 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

Page 16: Backup data from a Salesforce Org to Another

• You must go to Salesforce OrgB environment

and select Setup > Build > Customize >

Account > Field

David Boukhors - Expert Salesforce 16

Page 17: Backup data from a Salesforce Org to Another

• 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

Page 18: Backup data from a Salesforce Org to Another

• You also need to create a custom field on

Account and Contact objects to store the

external Id.

David Boukhors - Expert Salesforce 18

Page 19: Backup data from a Salesforce Org to Another

Now, open Talend Open Studio, select the

Integration perspective, and create a new job

David Boukhors - Expert Salesforce 19

Page 20: Backup data from a Salesforce Org to Another

Enter a job name (without space) and click on FinishDavid Boukhors - Expert Salesforce 20

Page 21: Backup data from a Salesforce Org to Another

In left panel, go under metadata > Salesforce and

select Create a salesforce connexion

David Boukhors - Expert Salesforce 21

Page 22: Backup data from a Salesforce Org to Another

• 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

Page 23: Backup data from a Salesforce Org to Another

• 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

Page 24: Backup data from a Salesforce Org to Another

• 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

Page 25: Backup data from a Salesforce Org to Another

• Drag and drop Account object under OrgA Connexion

on the middle panel

Select tSalesforceInput and click OKDavid Boukhors - Expert Salesforce 25

Page 26: Backup data from a Salesforce Org to Another

• Drag and drop Account object under OrgB Connexion

on the middle panel

Select tSalesforceOutput and click OK

David Boukhors - Expert Salesforce 26

Page 27: Backup data from a Salesforce Org to Another

• 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

Page 28: Backup data from a Salesforce Org to Another

• 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

Page 29: Backup data from a Salesforce Org to Another

• Double click on tMap component and select

AutoMap.

David Boukhors - Expert Salesforce 29

Page 30: Backup data from a Salesforce Org to Another

• 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

Page 31: Backup data from a Salesforce Org to Another

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

Page 32: Backup data from a Salesforce Org to Another

• Click on Apply, propagate the Change, and

OK.

David Boukhors - Expert Salesforce 32

Page 33: Backup data from a Salesforce Org to Another

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

Page 34: Backup data from a Salesforce Org to Another

• 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

Page 35: Backup data from a Salesforce Org to Another

• In the fFileOutputExcel component settings,

select the target file and check the include

headers box.

David Boukhors - Expert Salesforce 35

Page 36: Backup data from a Salesforce Org to Another

• 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

Page 37: Backup data from a Salesforce Org to Another

• 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

Page 38: Backup data from a Salesforce Org to Another

• 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

Page 39: Backup data from a Salesforce Org to Another

• 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

Page 40: Backup data from a Salesforce Org to Another

• 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

Page 41: Backup data from a Salesforce Org to Another

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

Page 42: Backup data from a Salesforce Org to Another

• 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

Page 43: Backup data from a Salesforce Org to Another

• 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

Page 44: Backup data from a Salesforce Org to Another

• 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