When we import Customer to ERPNext, we have to do three steps:
Import Customer
Import Address
Import Contact
When we have customer list with a lot of sames names like below (for example, John are two different Johns, whereas Jack is the same person)
Name Address Contact
John Street 1 622 123
John Street 2 0812 345 678
Jack Street 3 722 0437
Jack Street 4 0877 123 445
in ERPNext, when we import with same Name,
then the ID will be like this
John
John-1
Jack (there is no Jack-1 because itâs the same person, i only import 1 record)
Then go to Step 2 & Step 3,
If I donât know whatâs the primary key of the names, how can I make street 1 to go to John and street 2 to go to John-1? and both street 3 & street 4 go to Jack?
The same also with Step 3.
If I only have 4 records, we can do it manually. But if we have 2,500+ records, we need to find automated way to do this from the Data Import Tool or maybe MySQL tool like phpmyadmin?
We have some ideas, but stuck how to link it & also how to use phpmyadmin to generate the auto numbers generated by the address title, something also like John, John-1, etc.
We can successfully do import, but weâd like to match thousand of address / contact records to the correct customer IDs automatically, not by inputting one by one
So here I am, four years later, and still cannot seem to find the right solution to the issue. We have around 9k addresses to import (customers, suppliers, employees), most companies donât have a multitude of data, but we have a few that have literally dozens of contacts and addresses linked to them. Are there any recent news in this field, mostly for v.12, but I will probably switch over to v.13 as soon as itâs out, ERPNext wonât go into production use before autumn here, if needs be even in spring 2022!
It is the same problem of all ERP, a distinctive code is handled only at a low level. What must be done is to implement a Rest API in a loop, through the contacts and clients are created, they are assigned.
That was very helpful - thank you @EugeneP! Thatâs the most help Iâve found on the import process to date! I still have questions though.
In step three, you say:
I believe you are refering to this section of the Map Columns document:
My confusion stems from two things:
I donât know the Link Name at the time of import, because it is generated by ERPNext during the Contact/Customer/etc. import process. That makes it very time consuming to use when mapping addresses.
The Link Title can be inaccurate, because different people can have the same name and hence, have two different entries in ERPNext. Assuming that the Link Title is unique would lead to associating some addresses with the wrong Contact/Customer/etc, and leave other Contact/Customer/etc without an address at all.
The âLink Nameâ can be set manually. In the instructions given in the @EugeneP post you quoted, he is instructing you to build the âContactsâ and the âSupplierâ import tables first. Then use the magic of something like MS Excel or âLibreOffice Calcâ to build the âAddressâ import table using the template you get from the import tool. In the Address template there will be a column called something like âLink Nameâ
Again, using the magic of one of the spreadsheet programs, populate the âLink Nameâ column in the Address template with the actual full names of the âSupplierâ or âCustomerâ and save the template.
Then import first the Suppliers, then import the Customers, and finally import the Addresses. The Link Name column should then correlate the addresses to the correct suppliers and contacts.
Doing it this way also makes it very easy to locate the addresses properly in the GUI when your users are attempting to locate and modify any particular address because they can search by exact name.
However, even though all of this works, I do not know if it actually addresses the problem posed by the original posted several years ago when they run into multiple contacts with the exact same name.
Most likely the way to deal with that is to have the import tool report errors and continue with adding records. At the end use the list of errors to manually fix the ones that have the exact same name. I cannot imagine there would be any great number of those. Regardless, this would likely be the best fix.
It did help. I was able to run a (mostly) successful test import, and I was even able to import contacts in the same manner. I did run into two problems, however:
Some of my contacts have multiple phone numbers and/or email addresses, but there was only field I could use to import the data. Again, not an issue for short lists, but impractical for lists of thousands.
Before importing the addresses or contacts, I canât select a primary address or contact on the customer. Of course, importing the addresses and contacts doesnât alter the customer record. It sounds like I need a second import after the addresses and contacts are in place to select the primary records on the customer. Is that correct?
Am I correct in assuming you want to import the customer first, before the address or contact, but at such time also specify which of the succeeding addresses or contacts, although not imported (ie non-existent) as yet, will be the primary address or contact?
If this is what you anticipate, then I suppose youâre right in the sense that youâd have to do a subsequent import after the initial import of both customer and address/contact. However this final import is not for new records but and update. In which case export at least the ID column of the customer and the Customer Primary Address / Primary Address columns. I have never tried this but I presume youâd have to supply the ID of the address in these columns. Furthermore I have no idea as to how these 2 columns differ.
I may add, just in case, to not put the ID for the address as this messes up and gives an, logical, error for duplicate id key or already existing id key.
For others struggling, hereâs some of my notes on this. They need to be cleaned up, but hopefully they help give a starting point for those struggling with this - I know I sure did!
In ERPNext, emails, addresses, and phone numbers are separate DocTypes and are not just fields on the Contact document. Because of this, we need to import them separately into ERPNext and link them to the proper contact, customer, etc.
The process is the same for emails, phone numbers, addresses, etc., but letâs take for example the importing of Addresses:
This process assumes that the contact information has just been imported (without the address fields). If you are running this process at a later date, your fields may not line up when copy and pasting.
Process Files
This process will involve 3 files:
Original Contact Import (Letâs call it OCI)
Contact Template Export (Letâs call it CTE)
Address Template (Letâs call it AT)
Contact Link Import (Letâs call it CLI)
Prepare Data for Import
If you can, itâs best to take a snapshot of your system before doing imports - this makes it easy to roll-back in case of big issues.
Download the AT from the ERPNext Import tool.
To download the template you will need to create an address import using the frappe âData Importâ tool
Fill out AT file:
For each address field in OCI, copy and paste into the corresponding field in AT.
1. Tip: hide rows 3 to the second to last row in the OCI file, this way you donât need to drag down every column to select all the records.
2. Note: you will need to import multiple times if your OCI has multiple address fields like âAddress1_streetâ, âAddress2_streetâ, âAddress3_streetâ, etc.
If some fields donât exist, you may need to concatenate certain fields.
Check the doctype that you are importing to - and make sure you have populated all required fields.
1. If ERPNext doesnât have a field that you need, you can create a new field by customizing the built-in doctype.
2. If ERPNext requires fields that you donât have, you can update the field to be an empty string. This isnât ideal, but does get past the check.
An easy way to do this is to insert a column next to the one containing missing data, add a formula like: =if(LEN(AL2)=0," " , AL2), then fill down, then copy and paste over the original column (as values). Note: The Address doctype requires the âTitleâ field even though it isnât indicated as âmandatoryâ. By default, the ânameâ of the document will be âtitleâ+âaddress typeâ
Upload AT to a new Address import:
All the fields should map automatically since we didnât modify the AT template headings
You will probably get a few errors/warnings after uploading the file. Address the issues until all errors/warnings are gone:
1. âThe following values do not exist for â - You will either need to add the value or fix your import file to not contain that value
2. To make it easier to link addresses to contacts, it is best if all your records import successfully, otherwise, mapping addresses to contacts may be a bit trickier.
I found it easier to just roll-back and re-import corrected addresses until i got all address records to import (even if many were blank) (I used - when the field required a value. Then later, i can just filter and delete blank address records. Keeping the âblankâ addresses makes the linking easier.
Click âStart Importâ and hope all records are processed.
Now we need to update our âContactâ records to link the addresses to the contacts:
Create a new Data Import for âContactâ of type âUpdate Existing Recordsâ
Download the Contact template with all records (This will be CLI)
1. Select the âIDâ and âLink Name (Links)â fields and âExportâ
2. If there were some contacts in the system before you imported, ,just remove them from the bottom of the export file.
3. Duplicate the IDs for as many types of addresses you have to import (I.e. if you have 3 types of addresses, your ids should be duplicated 3 times)
Export all the Addresses (all you need is the ID and Address Type fields)
Filter by a specific Address Type and then copy the âIDâ field from AT (this is the name field in erpnext) and paste into the Link Name (Links) of CLI (Make sure the addresses are aligning with the correct contacts.)
1. Repeat for each address type. (You will have all the IDs duplicated multiple times - thatâs ok)
2. You can then filter by blank addresses and remove blanks (I filtered where text starts with --) then removed rows, unfiltered and save
Sort by contact ID and then add a new column to the beginning of the table and add the following formula to cell A3: =IF(B3=B2,"",B3), then drag down, and also copy cell B2 to A2. Then copy column A and paste as values into column B. What this did is cleared out the ID field where the IDs were duplicates - this allows child records to be imported into the parent record during the same import. If you try to do separate imports for each type of address, you will overwrite the child table each time and end up with only one linked address.
1. Remove column A after pasting values into column B.
Create a new Contact Import, upload CLI, and click Submit - hope it all goes through.
Good luck! - Youâll need it!
Take lots of backups, Try, fail, and repeat - youâll get it eventually!