Copy the content of the doc field

Hi everyone!

can you teach me how to copy the content of the field to another by means of coding?
fieldname

Using first field trigger you can done it
use follow code

user:function(frm) {
frm.set_value(“user_email”,cur_frm.doc.user);
}

i put it in “depends on” in user field.

put it in Custom Script if it is a Default ERPNext document. If you have it in a custom app, then you can write it in your doctype’s JS file.

Depends On is very different. It is used to check for conditions and decide whether to make this field visible or not

it thru’s an error

If you have directly used it is going to throw an error.

In custom script, there are many examples provided just below the editor. Have a look at those and you should be able to figure out. Two things are important - first what DocType you want this custom script to be executed and second at what event/hook should this function be invoked.

event/hook is refresh, on_save, before_save, etc. Have a look here:

https://frappe.io/docs/user/en/guides/basics/hooks