Run code on modal/dialog popup using client script

I am using Purchase Entry and when I add a new batch I want to load the selected Item into the quick entry dialog.

I did some searching and saw this

Has there been any change in this since 2022?

Not possible from UI side, you have to develop the code from backend side.

I have a somewhat unrelated question. When I run a client script on a field in a child doctype. Can I get the index of the row?
image
Like here. Can I get the index 0 for this?

frappe.ui.form.on('Purchase Invoice Item', {
	item_code: function(frm) {
              //My Code
	}
})
item_code: function(frm, cdt, cdn) {
var row = locals[cdt][cdn];
console.log(row.idx)

add it. then reload Ctrl+Shift+R and check it.

1 Like