Manually add options in Select (Child Table)

Hi,
I have a code, by which I am able to add options in a Select Box of Child Table.

frappe.utils.filter_dict(cur_frm.fields_dict["product_details"].grid.docfields, {"fieldname": "product_name"})[0].options = "PV/One Crease\nPV/One Auto ID\nPV/One LBS\nPV/Video Crease\nPV/Video LBS\nPV/Video Auto ID\nPV/Video BMT";

Actually, this code is working perfectly when I am using this code on selection of a checkbox but it is giving me an error when I paste the same code on the onload event of Sales Order.

Any idea what could be the reason?

Regards
Ruchin Sharma

To change the options of a field in a child table you can use:

frappe.meta.get_docfield('Child Table Name', 'field_name', cur_frm.doc.name).options = ['', 'Option 1', 'Option 2', 'Option 3'];
cur_frm.refresh_field('child_table_field_name');
5 Likes

@mibrahim
Thanks it worked for me.

Regards
Ruchin Sharma