One Star

updating records in SugarCRM from a CSV file

i want to update rows from a csv file into a Custom SugarCRM module (products module) .
delimited file > tmap > SugarCRMOutput
The Insert works great, i'm inserting products successfully.
since i want to update products that already exist,
i marked the "name" field as the key in the tmap becuase no two products will have the same name (see image)
i also set the Action field to "Update" (see image)
i want that rows in SugarCRM , with the same name as the csv record, will be updated and the rows with new name will be inserted.
it keeps inserting new rows with the same names instead of identifying that the name (key) already exists and doing an update. (see image)
in SugarCRM database the name is not the primary key , only the record ID (i don't know if this information is relevant).
what am i missing?
read about 30 posts... can't find a solution....
6 REPLIES
Moderator

Re: updating records in SugarCRM from a CSV file

Hi,
For component tSugarCRMOutPut, I think you just set the "Id" as the key to achieve your goal. See the related link: http://www.talendforge.org/bugs/view.php?id=951 "1. if the schema contains column "id", then the action is "update";
if the schema doesn't contain column "id", the action is "insert"." That means it is can only be triggered by the "Id" column.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: updating records in SugarCRM from a CSV file

Thank you Sabrina,
usualy , in csv files , there is no Id of the SugarCRM record, because the CSV comes from a web site or other external source that doesn't know what SugarCRM is.
My case is the same.
i have a list of products in a csv with a key of "name" (never the same name for two records)
i need to find a way in talend, to tell the SugarCRMoutput component or the tmap, to identify the "name" field in SugarCRM module (database table) as a key too.
This way update if the name exists, insert if the name doesn't.
thats what i did in the tmap as presented in the image. but it doen't work.
One Star

Re: updating records in SugarCRM from a CSV file

Hi sabrina,
to check if there even an option to update, i narrowed it down to a very basic example.
1. a delimited csv file with first_name and last_name columns only and two rows:
first_name,last_name
asaf,doe
oded,john
2. a sugarCRMOutput component for Contacts (default) module and the action set to "update".
3. tmap that maps between the first_name and last_name of the file as keys (they won't be two records the same) and connected to the SugarCRM schema with the contacts. both first_name and Last_name also keys in the schema. (see image)
i operated the job twice and again, even with this basic exmaple, i get 4 insert records, instead of two inserts and then 2 updates.
do you know if that was tested before?
becuase if there is no way to update records , only insert , then i'm affraid Talend won't have no use for me Smiley Sad
The source input (file or other machine) will never have the id of the sugar record, only names to match in SugarCRM database.
did anyone succeed in doing an update before?
Moderator

Re: updating records in SugarCRM from a CSV file

Hi,
Sorry for the inconvenience, I have searched talend bug tracker but not found a related bug.
Could you please open a JIRA issue in the Talend DI project of the JIRA bugtracker so that our developer will review it and find a workaround for you. Thanks for your contribution.
In addition, how about setting an id sequence number as key in tmap(see my pic)
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: updating records in SugarCRM from a CSV file

Thank you ,
but i already finished implementing an import of a csv file into sugar using SugarBean classes.
Talend was a too complicated tool for me and the information of SugarCRMOutput is very limited on the web.
also there is a serious cache problem with Talend and there is no "Rebuild" option. so everytime i made a change in the CSV file or in any other object on the canvas, i needed to delete them all and create then all over again.
This also didn't help for custom components, so i also needed to close the application and open it again and again in order to reload the custom SugarCRMOutput.
I think this tool is not yet ready for SugarCRM integration.
Moderator

Re: updating records in SugarCRM from a CSV file

Hi rodnikosh,
Thanks for your response and suggestion, we will do our best to improve our product. Hope it will helpful for you in your further job.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.