Failed to fetch a field from Address doctype into custom field of sales order

I am trying to fetch “pincode” field from address doctype into Sales order custom field “pincode”.
Address of the customer is loading automatically once we select the customer name. But particularly i need “pincode” field.
I have used this code “cur_frm.add_fetch(“customer_address”, “pincode”, “pincode”);” but this didn’t work for me.

i tried this piece of code also
frappe.ui.form.on(‘Sales Order’, ‘customer_address’, function(frm, cdt, cdn){{
‘method’: ‘frappe.client.get_value’,
‘args’: {
‘doctype’: ‘Address’,
‘filters’: [
[‘Address’, ‘customer_address’, ‘=’, locals[cdt][cdn].customer_address]
‘callback’: function(res){
frappe.mode.set_value(cdt, cdn, ‘pincode’, res.message.pincode);

But this code is generating an error “OperationalError: (1241, ‘Operand should contain 1 column(s)’)” .
Please give me suggestions to rectify these errors.

Hi @jithendra

Did you try add_fetch? Please refer below code

frm.add_fetch('customer_address', 'pincode', 'pincode') 

Hi @rohit_w thanks for the reply
I have tried
cur_frm.add_fetch(“customer_address”, “pincode”, “pincode”);
This code is not giving any response


frm.add_fetch(‘customer_address’, ‘pincode’, ‘pincode’)
This code is giving blank page when ever i select Sales Order .

Hi @jithendra,

Kindly share complete code

Hi @rohit_w
Sorry for the late reply ,i was hospitalized.
I am now able to fetch the data.Problem was in link fieldname.