how can i add value to to select field (Child table) by using custom script.
What is your use case?
Do you want default options from the beginning? Or on some conditions do you want to add or remove options?
yes i want default options from the beginning
frm.fields_dict.child_table_name.grid.update_docfield_property(
"child_table_fieldname",
"options",
["Draft", "Submitted"]
);
i used below code but there is no data paper in the select_field , keep in mind that the type of field set SELECT
frappe.ui.form.on('Sales Incentives Criteria', {
onload: function(frm) {
frm.fields_dict['sales_incentives_criteria_tab'].grid.update_docfield_property(
"select_field",
"options",
["Option 1", "Option 2", "Option 3"]
);
frm.refresh_field('sales_incentives_criteria_tab');
}
});
frappe.ui.form.on('Sales Order', {
refresh(frm) {
frm.fields_dict.items.grid.update_docfield_property(
"childtable_select_fieldname",
"options",
["Draft", "Submitted"]
);
}
})
frappe.ui.form.on('Sales Incentives Criteria', {
refresh(frm) {
frm.fields_dict.sales_incentives_criteria_tab.grid.update_docfield_property(
"select_field",
"options",
["Item Group", "Category","Item"]
);
frm.refresh_field('sales_incentives_criteria_tab');
}
});
i have also second field (dynamic_options), i want when i chose from select_field like Item Group or Item populate data and show it in dynamic_options
can you please share some screenshot
make “dynamic options” fieldtype as a “dynamic link” and in options give “select field name”
then it will work
thanks a lot
But i want ADD in the select field ADC Word and it not doctype ,i get this message " DocType ABC not found
The resource you are looking for is not available"
How Can I can add data to the field has dynamic link
Dynamic Link is refers to doctypes only.
If you want to add options other than doctype change the field to select fieldtype and use the above mentioned code under your child table and trigger it when u select value in the first select field
thanks