Hi Friends,
I need not mandatory fields for customize fields ( Image,Color,Category,Stem Size)while item group is “Services” for other item groups it should mandatory of customized fields
frappe.ui.form.on(‘Item’, {
refresh: function (frm) {
// Your custom logic here
},
item_group: function (frm) {
// Get the value of the "Item Group" field
var itemGroup = frm.doc.item_group;
// Check the value of "Item Group" and set the mandatory property accordingly
if (itemGroup === 'Service') {
frm.set_df_property('image', 'reqd', 0); // Make it not mandatory
frm.set_df_property('category', 'reqd', 0); // Make it not mandatory
frm.set_df_property('stem_size', 'reqd', 0); // Make it not mandatory
frm.set_df_property('color', 'reqd', 0); // Make it not mandatory
} else {
frm.set_df_property('image', 'reqd', 1); // Make it mandatory
frm.set_df_property('category', 'reqd', 1); // Make it mandatory
frm.set_df_property('stem_size', 'reqd', 1); // Make it mandatory
frm.set_df_property('color', 'reqd', 1); // Make it mandatory
}
}
});
I tried this code also but value missing error coming
Thanks in Advance,
Regards,
Sathyaraj