Customer create time add customer primary address in raised error

Hello, When i create version 15 bench in one customer create time add customer Primary Address field through Address that customer save time raied error message:
Could not find Row #1: Link Name: new-customer-hpacifvmgz
And customer not save how to solve this error?

Hi @Runway,

When you make a customer, remember to save the customer first before adding an address. Sometimes, if you try to add an address directly from the “Customer Primary Address” section without saving the customer first and then opening it in full-page mode, you might face issues because at that moment, the system doesn’t have the customer’s name or ID.

I hope this helps.

Thank You!

Ok Thank You @NCP it error not come when i first save customer after add customer primary Address but i want to set Customer Primary Address field mendatory that means i need to when create customer it also required address so how can it is possible in the customer doctype?

After save the customer, you can set the field mandatory. only have option.

If the customer’s primary address is not available when you save it, a client script can help redirect you to the address section.

Ok @NCP How it is possible?

Which way?

1 suggestion or 2?

2 Suggestion.

Hi @Runway,

Please check it.

frappe.ui.form.on('Customer', {
	after_save: function(frm) {
		if (!frm.doc.customer_primary_address) {
		    frappe.new_doc("Address", {"name": ""},doc => {
                let row = frappe.model.add_child(doc, "links");
                row.link_doctype = 'Customer';
                row.link_name = frm.doc.name;
            });
		}
	}
});

Please set your scenario in the script.

Thank You!

Ok @NCP Thank You