How to doc field into another filed?

ill create filed name gross total. ill try to get total and reflect to my filed name gross total. can somebody help me how to solve this?

@Denmark_Del_Puso,

try,

frappe.ui.form.on("Your DocType", {
	validate: function(frm) {
		frm.set_value('destination_fieldname', frm.doc.source_fieldname)
	}
}

@makarand_b ill try your code but it doesnt work

Can you share the code you tried and the way that it did not work (errors)? We won’t be able to help you without the details. :slight_smile:

@pratu16x7

frappe.ui.form.on("Sales Invoice", {
	validate: function(frm) {
		frm.set_value('total1', frm.doc.total)
	}
}

Your code looks alright (as I understand, total1 is the name of your ‘Gross Total’ field), and should update the value on saving. Do you find any errors?

yes ones ill try to create sales invoice, some of fields are missing.

@pratu16x7

Hi @Denmark_Del_Puso! Please take a look at your console to see traceback.

Right Click Browser > Inspect > Console

hi @creamdory thanks for your response, ok ill check

I see the error now. You forgot closing parenthesis at the end :

frappe.ui.form.on("Sales Invoice", {
	validate: function(frm) {
		frm.set_value('total1', frm.doc.total)
	}
});
3 Likes

thanks! @creamdory it works.

1 Like