I want to import bulk Customer Data but how can i create thier address and contact at same time.
So that the address and contact link with that customer. If I do manually then there are more time consumable and there could be error.
Is There any way to import address ,contact and customer data so import at a time and it link with each other. By Script Or Customisation
Hello @Mack , Yes it’s possible to import address, contact, and customer data with script; for that, we need to write a custom script based on the data we have in an Excel or CSV file.
You can import Customer data first. Then you can import address and contact data separately. I believe that you need 3 import operations in total.
But How to link that data to each other . Because it is do by manually, If i import these separatly
write a script to link address and contact in customer
def address(doc,method=‘None’):
try:
for link in doc.links:
# Check if the link is related to a Customer
if link.link_doctype == 'Customer':
customer_doc = frappe.get_doc('Customer', link.link_name) # Fetch the customer document
# Only update and save if the address has actually changed
if customer_doc.customer_primary_address != doc.name:
customer_doc.customer_primary_address = doc.name # Update the primary address
customer_doc.save(ignore_permissions=True) # Save the changes without permission checks
# Check if the link is related to a Supplier
elif link.link_doctype == 'Supplier':
supplier_doc = frappe.get_doc('Supplier', link.link_name) # Fetch the supplier document
# Only update and save if the address has actually changed
if supplier_doc.supplier_primary_address != doc.name:
supplier_doc.supplier_primary_address = doc.name # Update the primary address
supplier_doc.save(ignore_permissions=True) # Save the changes without permission checks
except frappe.DoesNotExistError:
frappe.log_error(f"Customer or Supplier not found for doc {doc.name}.")
except Exception as e:
frappe.log_error(f"An error occurred while saving Customer or Supplier: {str(e)}")
At What Basis i link them , there are two customer with same name so what to do
try to basis of id
In the code this code define if in address or contact in link table link doctype is Customer but i nimport the New record then how it possible
“When uploading data in the Address document, include a link table field to specify the linked document type( customer) and linked document name.”
yes its possible