Get Data from link type in child table

Hi,
I wanted to know how do we fetch data in child table from linked doctype.
I am facing the problem while dealing with sales invoice doctype, which has Sales Invoice item as child table and Sales Invoice Item has Item as linked doctype. I created a field, say my_field in Item doctype and since Item doctype is linked with sales order Item with name item_code, to get the data here, I used item_code.my_field in options. But data is not being reflected. What am I missing?
Please Help.

Regards,
Durbar Dasgupta

I think field in Sales Invoice Item should be read only

Just because there is a link between the sales order item and the item doesn’t mean all the fields are accessible from the sales order item.

Are you doing this in javascript or python? Either way, you need to grab the value from the Item doc.

For python:
value = frappe.get_value('Item', item_code, my_field)

For javascript:

   frappe.call({
        	method: 'frappe.client.get_value',
        	args: {
        		'doctype': 'Item',
        		'filters': {'name': item_code},
        		'fieldname': [
        			'my_field'
      		]
      	},
      	callback: function(r) {
      		if (!r.exc) {
      			value = r.message.my_field;
      		}
      	}
      });

Please refer the links below.

https://frappe.github.io/erpnext/user/manual/en/customize-erpnext/articles/creating-custom-link-field

https://frappe.github.io/erpnext/user/manual/en/customize-erpnext/custom-scripts/custom-script-examples/custom-script-fetch-values-from-master

Hope this helps.

Thanks all for the reply.
I was able to link doctypes and fetch data by python code.
There was already a class made, I just used that class to create an object for my purpose.