I have two custom fields, field1 which selects work progress(“completed”, “working” etc), field2 is datetime field to track day & time of completion.
I want datetime field2 to auto fetch Now/current time when “completed” is selected in field1.
I have two custom fields, field1 which selects work progress(“completed”, “working” etc), field2 is datetime field to track day & time of completion.
I want datetime field2 to auto fetch Now/current time when “completed” is selected in field1.
frappe.ui.form.on(‘Your DocType Name’, {
your_field1_name: function(frm,cdt,cdn) {
var row=locals[cdt][cdn];
if (row.your_field1_name === “completed”) {
row.your_field2_name=
frappe.datetime.now_datetime();
}
frm.refresh_field(“child_table_fieldname”)}
});