Script to set the value in Doctype Field

cur_frm.cscript.rate = function(doc, cdt, cdn) {
var charge = frappe.get_doc(cdt, cdn);
var amount = (doc.basic_cost * charge.rate)/100 ;
frappe.model.set_value(cdt, cdn, “tax_amount”, amount);
}

Now i want to set the value in one of Doctype field “total” earlier i have use following script

frappe.set_value(“charges_total”,frm.doc.charges_total + charge.tax_amount);
But it’s not working i think it never get the object of Doctype
Can anyone tell me the script for that please…!

i always use
cur_frm.set_value(‘total’, amount);
refresh_field(‘total’);

3 Likes

Thanks for reply @geekroot…It’s working

@geekroot refresh_field not required if you use frm.set_value

4 Likes

thanks for reply @rmehta that i have done.