Client Side Script Help

This is specific to items being added to the Stock Entry doctype.

When I click Add item…, the modal form becomes visible.
On the modal item form, I have a custom field which is only visible based on certain values in the UOM field. I would like to now filter the results in the custom field based on the item code. How should i set up the script? I tried to get notified of changes in the item_code field but am stuck.

My effort so far:
frappe.ui.form.on(“Stock Entry Detail”, “onchange”, function(frm) {
console.log(“something happend”);

@Prashanta_Mahato use form_render, instead of onchange