Add_fetch() to bring in values from anotherDocType

I’ve been looking to bring in My company address to our Sales Invoice (When a sales Invoice is created). So after looking at several threads. I thought of using the “address” (Row #47) field inside the Company Doc.

And I made a custom field “my_company_address” (Row #2) in the Sales Invoice Doc.

Then made a Custom Script under Sales Invoice

cur_frm.add_fetch(“Company”, “address”, “my_company_address”);

Nothing worked, so changed it to
cur_frm.add_fetch(‘Company’, ‘address’, ‘my_company_address’);

Still I’m getting nothing, thinking that the script is not running we added the following line as to Debug,
msgprint(__(“Hello”)); ---- it worked

Could anyone suggest where and what I’ve done wrong not being able to pull the address??


please check the syntax for the add_fetch method.

the first argument is link_fieldname, where you have mentioned the Company it should be fieldname instead of doctype name.

e.g. add_fetch('company', 'address', 'my_company_address')


Appreciate your support. While waiting for the reply I feared that this was the case. Could you tell me this,
Are the fieldname values unique to the entire database? Or they are local their respective DocTypes? I ask you this because if I create the same fieldname on two different forms will they end up showing an error they will start copying each other’s values?
If I’m to refer a fieldname value in another DocTypes, what is the recommended procedure?

push that topic, same question…

no answer?