Fetch batch number by filter according to item code and suggestion in select options

Hello everyone,

i am trying to fetch batch number in select option when we enter the item code in Material Request Plan Item table, wrote custom script for Material Request Plan Item but didn’t help, can any one suggest me please. how to achieve that task.
my custom script is:

frappe.ui.form.on("Material Request Plan Item", "batch_no", function(frm, cdt, cdn) {
    var d = locals[cdt][cdn];
        frappe.db.get_value("Batch", {"item_code": d.item_code}, "batch_no", function(value) {
            //d.expiry_date = value.expiry_date;
            if(frm.doc.item_code == d.item_code)
    set_field_options("batch_no", value.batch_no);


Hey, did you figured it out?

execute this command to fetch the batch number
cur_frm.add_fetch(link_field, source_fieldname, target_fieldname);
from client script…!!

cur_frm.add_fetch(item_code, batch_number, batch_no);