Link custom field to another custom field in a different doctype


I created a “sales name” field in the doctype “item.” I’ve added this field to the quotation document.

I would appreciate any suggestions on how to get quotation_sales_name to pull the data from the item_sales_name field when I enter the Item code into the quotation.

Ideally: the quotation_sales_name would pull from the item_sales_name which depends on which item code I select.

thank you very much

Hi Sofia,

Use add_fetch() method.

cur_frm.add_fetch(link_fieldname, source_fieldname, target_fieldname)

Thank you!

Sorry for my ignorance but do I type that into my terminal, virtual box, or somewhere else? Do I need to activate developer mode to do this?

thanks again

Create Custom Script for Quotation doctype and add code there.

1 Like

I created the custom script but when I make a quotation the data isn’t generated in the new field. It remains blank. Is there something else I need to do to pull the data?

thanks again

please share your code

cur_frm.add_fetch(“item_code”, “nombre_de_venta”, “nombre_de_venta”)

The code is under the doctype “Quotation Item” and the source field is located in the “item” doctype.

thank you!

Write it under “Quotation” instead of “Quotation Item”
For more help, please see

1 Like

thank you!

I tried to go to the link but got a 404 error. Has this page been moved somewhere else?

new link is

Hi guys,

This is thread is great! But will this work in this situation:

Created a new child table in Sales Order called Sales Order Table
Create a new child table in Production Order called Production Order Table,
On selecting Sales Order in Production Order, I want the Production Order Table to fetch the custom fields from Sales Order Table.

Which DocType will I need to write the script in?

Did any one have this Script ??

hello Sir,
I have one link filed in my request for quotation doc.
the filed is quality profile.qx
in that i have one link field when i click on that then one table is open .and this i want to show in website supplier portal in rfq_items.html i have this line
{{d.quality_profile}} so it will display only the filed name i want to show the link here how this possible can u please help me …