Add row to child table AND set value of row's field

The first part of this question has been answered before. Adding a row to a child table:

var d = frappe.model.add_child(cur_frm.doc, "Quotation Item", "items");

Normally I would set the value of the row’s fields using:

d.item_code = x;
d.qty = y;

In this case, I require setting item_code and triggering the script that runs when item_code is set. I assumed I should use frappe.model.set_value but I’m not sure of the right way. I’ve seen examples like this in the code but no luck. Any help is appreciated.

   frappe.model.set_value(row.doctype,, "field_name", x);

Triggering the field manually works. Not sure if its the best way.

cur_frm.script_manager.trigger("item_code", d.doctype,;

@Kar_M that is the right way.