Wednesday, February 8, 2012

Scheduling Talend job


You can schedule the Talend job by TIS (one of the commercial editions) or by using Windows scheduler. With the commercial edition, the entire job runs from the server and if you use Windows scheduler it will execute the job only when the system in which TOS is installed, is running.


I am going to tell you the steps to schedule it using Windows scheduler:


1. Right click on a job, select 'Export Job Scripts'


2. Give the location for the .zip content of the job and Select 'Finish'.


3. Extract all the contents of the .zip file, it must contain a .bat file. 


4. (Win XP) Goto Start->All Programs->Accessories->System Tools->Scheduled Tasks->Add Scheduled Task


5. In the 'Scheduled Task Wizard' select 'Browse'. Find the .bat file of the Job in the extracted folder. Assign a name to the schedule.


6. Enter credentials for system password, schedule time etc.


7. It will execute the .bat file in the schedule time period.


I hope the above steps would help you.

Link child record with the respective parent record in Target org. using Talend.


Whild migrating the child records from one Salesforce org.(OrgA) to another(OrgB) I was facing hard time to link the child record with the respective parent record in target org.(OrgB). Because when you create new record in Salesforce it will create it with the unique Id in target Org.(OrgB).


I though this would be the common scenario while migrating data from one Org. to another. So, I am going to provide you the step by step process to link the child record with the respective parent record:


1. First thing you need to do is to create a custom field say ExternalIdField on Account object in target org.(OrgB) and select the External ID check box.


2. Follow the steps which I have provided in my previous post to make the connection between source org. to target org. 


3. We use tMap to create the mapping between the org.'s, double click on it and link the id field of Account(OrgA) to the ExtenalIdField custom field on target org.(OrgB).


4. Run the job, it will migrate account records from OrgA to OrgB.


5. Next time when you do the same for child records say Contact records; first fetch the child records(tSalesforceInput) from OrgA and Parent record (tSalesforceInput) from OrgB.(Select id, ExternalIdField__c from Account).


6. Drag the tMap and tSalesforceOutput(OrgB) component into the designer view.


7. Now double click on tMap componet, it will open the new window, on the left hand side you must be seeing two table(Contact (OrgA) and Account(OrgB) tables), 
drag the look up field of Contact into ExternalIdField of Account, in this way you have link the lookup field of Contact(OrgA) with the ExternalIdField(OrgB).


8. After that, drag the id field of Account(OrgB) to the Account lookup field on Contact(OrgB) on the right side of the tMap component, in this way you are inserting the Account(OrgB) id into the lookup field of Contact(OrgB).


9. Now just run the job, it will insert the contact record and will link it with the parent record as well in the target org.(OrgB).


I hope this will help you.

Friday, February 3, 2012

Integrate Salesforce Using Talend



I came across with a requirement in which I have to migrate conditional data from one Salesforce org. to another. So I explore Talend ETL tool to do the task and I found this tool a really very easy and helpful tool to migrate the data. I am going to tell you the steps by steps process:

1. You can download Talend Open Studio for Data Integration from http://www.talend.com/download_form.php?cont=gen&src=HomePage

2. First you need to create a Job in the IDE

3. On the left hand side under Repository section -> Job Designs-> Right click->Create Job

4. Create saleforce connection, Repository section -> Metadata->Salesforce-> Right click->Create Saleforce connection

5. Source Org.A
Enter the name of the connection(say MySaleforceSourceOrg)
Enter login credentials and click on Check Login button, it should show Connection successful
A salesforce connection with the name MySaleforceSourceOrg should be created now right click on it and Retrieve Saleforce Module
Now select the account and click finish
  
6. Do same steps for Target org.B (MySaleforceTargetOrg)as well 
  
7. Till now you have created the Job and salesforce connection for source and target org.

Talend provide standard components that we can use to fetch or insert data into Salesforce.com. 

Ex:- tSalesforceInput : Allows to extract data from a Salesforce DB based on a query.
 tSalesforceOutput :- Allows to write data into a Salesforce DB.
 
8. Now we need to link source org (MySaleforceSourceOrg ) connection to target org. connection (MySaleforceTargetOrg.)

9. Open MySaleforceSourceOrg connection and drag the account module into the job designer panel, and select tSalesforceInput component from the pop-up window.

10. Open MySaleforceTargetOrg connection and drag the account module into the job designer panel, and select tSalesforceOutput component. 

11. Search for tMap component on the right side under Palette section.

12. Drag tMap  component in between tSalesforceInput and tSalesforceOutput component into the designer panel.

13. Right click on tSalesforceInput  component ->Row->Main and drop it into tMap.

14. Right click on tMap->Row->Main and drop it into tSalesforceOutput component

Now both the connection and tMap are in the designer panel. Right click on tSaleforceInput  component in the designer panel and select setting, it will automatically filled the username and password section. Now check the "Manual input of SOQL query" section. and write "Select id, name from Account limit 10".
Select tSaleforceOutput, right click on it and click on setting. It will open the component section and select the Action as insert.

At the last select the Run(Job) tab adjacent to component section. finally click on Run button and you are done.

It will send the source account record from Saleforce OrgA to Salesforce OrgB.