How to fetch details of ID field to another custom field

Hi,
I want to to fetch details of ID field to another custom field in the same form, tried different method, but didnt work.
please advise.

Hey @ramalyb

you can use this client script to achieve the functionality

frappe.ui.form.on('Quotation', {
    refresh: function(frm) {
        frm.set_value('custom_id', frm.doc.name);
    }
});

change the custom_id to your fieldname.

you can also use after_save function instead of refresh to set the field only once. refresh function will keep updating it.

Thanks.!

1 Like

Thank you @Balamurugan_Ravichan . it worked when i refresh the form after saving. is there anyway to populate the same while saving the form?

Thank you again @Balamurugan_Ravichan its working nicely.