Transfer custom-field data from one Doctype to another Doctype

Created a custom field in the Sales Order and also created the same field in the Sales Invoice.

If I am creating a Invoice from a sales order with the use

Sales Order
Create > Invoice

Sales Invoice
Get Items From > Sales Order

So the value that I entered in the custom field of the sales order should be in the custom field of the sales invoice.

Sales Order custom-filed

Sales Invoice custom-field

I looked through many frappe forum posts but couldn’t find a solution.
Please help me in this.
Thank You.

I noticed an error :sweat_smile:

Please double-check the field names. In the Sales Order, the field name is custom_test_field, while in the Sales Invoice, the field name is custom_test_field_. As you can see, an underscore (_) is added in the Sales Invoice, which prevents the data transfer. Ensure the field names are identical to facilitate the data transfer.

Don’t know how this happened but when I deleted that field and re-created it, it came back properly. Same field name is there in both Sales Order and Sales Invoice.

But I don’t understand how to do this. If you could have written some reference or script, it would have helped me a lot.

Thank You.

If the same name field and when you create a sales order to sales invoice then automatically data will transfer, without code.

If I create this transporter information of delivery note in the same sales invoice then how will I achieve it in that case because the field names will be different.

screen-shot

Please again check the Sales Invoice because transporter information also available in there with same field name.

Yes, it is also in the sales invoice. Thank you so much for your reply.