keeping "retrieve inserted id" values with tsalesforceoutput

Four Stars

keeping "retrieve inserted id" values with tsalesforceoutput

I have a manual salesforce insert routine that I'm trying to replicate in Talend, and I think maybe I just need a slightly different approach.

Manual version: I read a view from mssql with student records and about 25 columns. I insert 8 columns into accounts and get back an accountid for each one which gets added as a column to the recordset. Then I insert 12 or so columns into contacts, one of those columns being the accountid. Now the new contactid is also added as a column in the recordset. Then I insert the remaining 5 columns plus the accountid and contactid to a custom salesforce object, and it returns the id for that column, which also gets added as a new column in the recordset. After the 3 rounds of inserts, I go back to the original mssql database and store the 3 salesforce id values.

Talend version: I read the view from mssql, have it feed into a tmap, and map the 8 pertinent account columns to feed into a tsalesforceoutput/insert. I have "retrieve inserted id" turned on, and the accountid values do come back successfully, but the column gets added to the 8-column recordset that came OUT of the tmap, not the recordset that went INTO the tmap. Once I've inserted these 8 columns into accounts, I need to insert contacts, but the columns containing the contact information don't exist anymore except in the original recordset. I can't seem to pass through the rest of the columns through the tmap. How do I get the accountid back into the original recordset and have that recordset feed into a new tmap for purpose of inserting contacts and have the new accountid available as a column?
Community Manager

Re: keeping "retrieve inserted id" values with tsalesforceoutput

Hi 
Use a tFlowToIterate component to iterate the incoming data from mssql table, so that you access other columns on other component after retrieving the inserted id, for example:
tMssqlInput--main(row1)--tFlowToIterate--iterate-->tFixedFlowInput_1--main--tSalesforceOutput_1--main--tMap_1-->tSalesforceOutput_2--main--tMap_3--main--tSalesForceOutput_3
on tFixedFlowInput_1: generate the current data with the first 8 columns for inserting into accounts model, for example: define a column called columnName, string type, on the schema, and then, select the "Using single Table" mode and set the column values:
(String)globalMap.get("row1.columnName")
// or (Integer)globalMap.get("row1.columnName") for Integer/int type
// or (java.util.Date)globalMap.get("row1.columnName") for Date type
// or other type
on tMap: in the output table of tMap, define the current data with another 12 columns as you did on tFixedFlowInput.
Hope this will help you.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog