Contacts CSV import

I need to import a large number of contacts. I tried to follow the instructions reported in https://docs.axelor.com/adk/5.0/dev-guide/data-import/csv-import.html without any success.
I am asking if someone has a xml and a contact related csv file working as an example.
Thank you in advance

1 « J'aime »

Hello,
You may try to import data directly on Postgresql database by using PGadmin instead of Axelor user interface.
Regards
Eric

Hi,

I don’t think that update the db was a good way to import.

“Contact” is not a domain itself, “Contact” is a “Partner” object with some specific flag to be taken as a contact and not as a company.

Maybe you could have a look here modules\abs\axelor-base\src\main\resources\demo\fr to see how to correctly setup your import file.

Hi All,
Thanks for the answers. I’ll try with PGadmin but I understand that the contact record is a complex “thing” and the different roles depend on flags.
I have already analyzed the xml file in modules\abs\axelor-base\src\main\resources\demo\fr even if the English version.
However I need to isolate part of the xml file in order to use only the portion that refers to contacts / partners records because I want to import only them.
This is why I am asking if anyone has ever tried to do this type import.
your help would be appreciated
Thanks
Gabriele

hi,
I never have to import contacts but I don’t think that it’s a huge task. All depends on what you need to import for a contact entry: user base info (names, email…), address, company, etc…

Could you please specify which fields you want to fill and maybe I could help you to isolate part your require.

Regards

HI,
Thank you for your cooperation. Below I will list all the fields I want to import. The idea, I hope it’ s right, is to take the contacts I have and store them. The fields are:
« importId »; « partnerTypeSelect »; « isContact »; « isCustomer »; « isSupplier »; « isEmployee »; « name »; « firstName »; « titleSelect »; « languageCode »; « address »; « email »; « fixedPhone »; « mobilePhone »;
in this way I should have the contacts classified in the correct categories and then, through axelor, I could transform them into lead, customers and so on.
I tried with a very trivial file. The import ends without errors but nothing is imported. Unfortunately I’m new to axelor and I’m having some difficulties.
Gabriele
these are the files I am using
XML

<?xml version="1.0" encoding="UTF-8"?>









<input file="partner01.csv" separator=";" search="self.importId = :importId" update="true" type="com.axelor.apps.base.db.Partner"
	call="com.axelor.csv.script.ImportPartner:updateContacts">
	<bind column="importId" to="importId"/>
</input>
"importId";"partnerTypeSelect";"isContact";"isCustomer";"isSupplier";"isEmployee";"name";"firstName";"titleSelect";"languageCode";"address";"email";"fixedPhone";"mobilePhone";"invoiceSendingFormatSelect";"paymentMode.importId";"paymentCondition.importId";"partnerCategory.code";"currency.code";"blockingList.importId";"rejectCounter";"companySet_importId";"customerAccount_code";"supplierAccount_code";"mainPartner_importId";"customerTypeSelect";"supplierTypeSelect";"industrySector.importId";"user.importId";"team.importId";"source.id";"fiscalPosition.importId";"picture_fileName";"invoicesCopySelect" 900;1;"false";"true";"true";"false";"APOLLO11313";;;"fr";90;"info@APOLLO11313.fr";"04.35.78.88.99";;"emailpaper";8;6;"SME";"EUR";;;1;4121100;4021100;;3;1;4;11;2;5;;;190110 901;1;"false";"true";"true";"false";"APOLLO11414";;;"fr";90;"info@APOLLO11414.fr";"04.35.78.88.99";;"emailpaper";8;6;"SME";"EUR";;;1;4121100;4021100;;3;1;4;11;2;5;;;1 902;1;"false";"true";"true";"false";"APOLLO11515";;;"fr";90;"info@APOLLO11515.fr";"04.35.78.88.99";;"emailpaper";8;6;"SME";"EUR";;;1;4121100;4021100;;3;1;4;11;2;5;;;1 903;1;"false";"true";"true";"false";"APOLLO11616";;;"fr";90;"info@APOLLO11616.fr";"04.35.78.88.99";;"emailpaper";8;6;"SME";"EUR";;;1;4121100;4021100;;3;1;4;11;2;5;;;1

The result !!!

Hi,

If i’m not wrong the “update=true” flag only update existing row. Thus, you have to remove this flag to be able to insert new rows.

Address is also a domain so I you have to create an import file for the address (which need to have an importId field) and set the field “address.importId” inside contact csv with the associated address importId field.

Regards

Hi femtonex,
nothing has changed! The result of the import is not different.


But … in the contact or partner window and even leads nothing happens!
I hope you have some suggestions.
Thanks again for your time.
Gabriele

Hi,

Could you please provide your xml and csv u used ?

Thanks

Hi femtonext,
after so many attempts I’m a little bit confused so I’ll restart from the simplest things.
The system help ("_https://docs.axelor.com/adk/5.0/dev-guide/data-import/csv-import.html) says that:
"If the CSV data files have identical columns with the field names of the target domain model class, it can be imported automatically with minimal configuration.".
So, using the contact csv file:
title.code,firstName,lastName,email,phone,dateOfBirth,group.code,company.code
mr,Peter,Parker,peter.parker@gmail.com,1988-11-11,friends,
mr,John,Smith,jsmith@gmail.com,1979-11-01,friends,my

The import process should be really simple. If I correctly understand the xml file should be:

Very Simple !!!
BUT … The result is

image

Where am I wrong?

Thank you in advance.

as explained previously there is no “com.axelor.contact.db.contact”. You have to use com.axelor.apps.base.db.Partner. This is the same object form “Company” et “Contact” which are managed using a single domain “Partner”.

Just use base_partner.csv and look inside the base_config.html and use it as a sample