Refresh_field not working?

Good day everyone!
Just a little concern about refresh_field. Base on the code:

cur_frm.cscript.item_code = function(doc, cdt, cdn) {
	var d = locals[cdt][cdn];
	frappe.call({
		method: "gaisano.seevents.get_uom",
		args: {
			"name": d.item_code
		},
		callback: function (r) {
			console.log(r.message["uom"])
			d.uom = r.message["uom"]
			refresh_field("uom");
			console.log("finished")
		}
	});
}

Everything seems to be working properly except the refresh_field part.
Is something wrong about the code?. Please help. T_T

It could be reset by another part of the code (?)

similarly, i too face this issue…refresh_field is not working propoerly.

Does

cur_frm.refresh_field('fieldname');

help?

1 Like

Hi,
Thanks for the reply @lasalesi i already tried this but it is not working.

OK, so when you say not working properly, what exactly happens? You have an async call, set the variable in the server-side code, and after refresh_field it still does not show in the frm.doc? Have you tried to add debug steps such as

console.log(frm.doc);

before and after the call and check the states?

2022 and not working for me. Both cur_frm.refresh_field() and cur_frm.refresh_fields.
It returns undefined