ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

How to refresh the field

Hi,

Before patch update, the below script was working fine for refreshing the batch field in the Sales Invoice document. But now it is not working.

So kindly look into it and do the needful.

frappe.ui.form.on('Sales Invoice', {
    validate: function(frm, cdt, cdn) {
        var d = locals[cdt][cdn];
        console.log("dbatch",d);
                if(d.batch){
                var batch = flt(d.batch);
                d.batch = batch ;
                refresh_field("batch ");
                }
             
    }
});

to update a field, you need to use this syntax:

frappe.model.set_value(cdt, cdn, "FIELD_NAME_HERE", "some value");	
refresh_field("FIELD_NAME_HERE");

You were close!

2 Likes

Hi @mel_erp,

Thanks, It is working fine now

how to do in web forms ?