Fetch address text on a custom field

Hi @Shaun,

Please again apply it.

frappe.ui.form.on('Your DocType', {
    refresh: function(frm) {
        frm.add_custom_button(__("Address"), function() {
            if (frm.doc.address){
                return frm.call({
                    method: "frappe.contacts.doctype.address.address.get_address_display",
                    args: {
                        "address_dict": frm.doc.address
                    },
                    callback: function(r) {
                        if(r.message)
                        frm.set_value("full_address", r.message);
                    }
                });
            } else {
                frm.set_value("full_address", "");
            }
        });
    }
});

The above script worked properly on our side.
Please set your doctype name and address field name according to.

Thank You!

2 Likes