Try ERPNext Buy Support Partners Foundation Foundation Members

Address is not displayed properly while fetching

Hi,

I have a custom doctype and it has a field for email_id, mobile_no and address which is linked with customer. Email and phone no is fetching properly. Address is showing in below format,


I have given below script,

frappe.ui.form.on(‘Customer Complaint Recording’, {
setup: function(frm) {
frm.add_fetch(‘customer’, ‘email_id’, ‘email_id’);
frm.add_fetch(‘customer’, ‘mobile_no’, ‘mobile_no’);
frm.add_fetch(‘customer’,‘primary_address’,‘address_display’);

}
});

Not sure what field type i should give now its in small text.

Thanks in advance!

Change your custom field’s type from small text to HTML field. That address_display in Address doctype is an HTML field.

Thanks for the info, when i am changing to HTML field type the address field is not showing.

HTML Field will not show on form without data ,you need to render the data for this field
In js side you can do like this
$(frm.fields_dict[custom_field].wrapper).html( data to render)
refresh_field(“custom_field”)

1 Like

Ok thank you, will try like that and check.

Should i add this code in js file, can you tell me the format for adding in custom script.

Thanks!

It is working now after making address field as readonly.