How to use "fetch from" function when pulling data from other DocType

In DocType “Sales Invoice Item” I added two fields, country_of_origin and customs_tariff_number.
The two field are of “Link” type, with correct options inserted.
What should I put in “Fetch From” in order to get the fields automatically fetched when I create a new invoice? These fields are filled in for each item. I wrote “item.customs_tariff_number” but it doesn’t work.

You should use the name of the item link field. item_code i think. So it will be item_code.customs_tariff_number

3 Likes

Thank you so much. Documentation is unfortunately missing or unclear at this point.
This is a powerful function of the system which should be properly documented.

8 Likes

Does anyone know if the “fetch from” can fetch custom field data into a new custom field?
My example is fetching Sales Order Item custom field data into a Delivery Note Item custom field:
so_detail.customer_line_no
It doesn’t appear to work

I don’t recall any so_detail DocType.

The Link is the DocType target and the field name should be the fetch from object.

so_detail is the field name on the Delivery Note Item for the linked Sales Order Item. customer_line_no is the custom field on the Sales Order Item.

@casesolved-co-uk if specific to Delivery Note and Sales Order, have you tried using the same field name? I believe ERPNext will inherit the same field values from SO to DN if the custom fields are the same. Presumably might work even with the item tables in those forms (have not tested though).

@laurence I’ll give it a go thx!

Yes that works provided the document is copied using get_mapped_doc

1 Like

What is ‘get_mapped_doc’
The problem i am facing is that m able to fetch value from other doctype when the ‘Read Only’ property is ON, i need to edit the field after fetching so i DO NOT want to check on ‘Read Only’.
So if i check off the Read only, the field value is NOT populated at all.
Any one can please help with this…?

What is ‘get_mapped_doc’
The problem i am facing is that m able to fetch value from other doctype when the ‘Read Only’ property is ON, i need to edit the field after fetching so i DO NOT want to check on ‘Read Only’.
So if i check off the Read only, the field value is NOT populated at all.
Any one can please help with this…?