Button redirecting

I want to redirect to a doctype if I click a button in order to add new data from the doctype and display it to the form where the button is present.

Just like this. If I click the new address button, I will be redirect to the address doctype to enter data.

When I enter a data into the address. it will also output the result to the same form where the button is present.

How can I create it? Sorry i’m new to ERPNext.

Hi @Bernard_Gresola,

Similar functionality is already available in Customer Form. please check the customer.js

Add the address_html and contact_html as HTML fields and use the erpnext.utils.render_address_and_contact(frm); method

Thanks, Makarand



I want to create my own with different data and inputs and I want a mechanism like the picture above.

Hello sir,

Sir i am trying as the way you said but not able to make it.
Sir can you tell me what i am doing wrong and what is the right way to create same new address button which customer doc have.
My step

  1. First i add address_html field in my doc business_unit.
  2. Then as you said sir i add dynamic link
    frappe.dynamic_link = {doc: frm.doc, fieldname: ‘name’, doctype: ‘Business Unit’}
  3. Then i doing
    frm.toggle_display([‘address_html’], !frm.doc.__islocal)
  4. frappe.contacts.render_address_and_contact(frm);

Sir i am very new to erpnext. Please help me how to make it this correct.

same problem

here is my custom script:

frappe.ui.form.on('Venues', {
	refresh: function(frm) {
		frappe.dynamic_link = {doc: frm.doc, fieldname: 'name', doctype: 'Venue'}