Add fetch functionality

Hi team,

I have two fields
Item(link to Item) and Item Name(read-only data field)

I use add_fetch for receiving Item Name from Item and everything works great but when I remove Item(link field) the previous data in the Item Name field is still there and it is a read-only field(it is important to have it read-only). My question are it is normal add fetch functionality and how I can resolve it(clear read-only data field)

Hello,

To make add fetch work on these lines, you should add read-only field only. If you want to have target field as a data or small text (editable) field, then you can following the approach of Custom Script for it.

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

Hi, thank you for your answer. Here is my problem. Add fetch works when I choose Item but if I want to remove Item, old Item Name still there.

If you select another item, which is a mandatory field, then value will be auto-updated in the Item Name field.

To have Item Name as an editable field, please add another Custom Field and write Custom Script to have Item Name fetched from Item master. In this case, you will be able to edit Item Name as well.

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

Thanks for your answer, yes if I select other item everything is ok. But if I don’t want to have Item, I should write Custom Script. Thank you

If you have used ERPNext, and liked it, then please help us spread the word by submitting your reviews on the following sites.

We as a community can achieve lot more than as individuals.