Change item rate field

Hello all,

i wan’t to fix sales order item rate by custom script when choose item_code.
i’m try to write custom script is

frappe.ui.form.on(“Sales Order Item”, “item_code”, function(frm, doctype, name) {
var row = locals[doctype][name];
row.rate = 50;
row.amount = row.qty * row.rate;


**** value 50 is test for this script and i write my function for value after ****

in console.log is display rate = 50 it’s OK. but in screen is get item price list and store in rate field.
and amount is calculate by item price list.

in case every row when i add item code in grid it’s fetch item price from price list to rate field. i cannot change value in rate field

how can fix rate by custom script and update in rate field.
help me please.