How to get item onhand quantity in custom script

i have used many fields like “actual_qty”, “balance_stock”, “onhand_qty” but i am getting undefined ,what is the issue?

if you run this in the Sales Order with at least 1 item then it must print actual qty if available

cur_frm.doc.items[0].actual_qty

1 Like

No this is not working , actually i am creating a client script for low stock alert when inventory falls below a specified field.
i have tried this -:
frappe.msgprint("onhand qty " + frm.doc.items[0].actual_qty);

but it’s not working .

can you specifiy which doctype, fieldname you want work on and also do you want print message before save or after

i have a requirement "In the item doctype if available stock is less than “stock_limit” field then alert should generate.
Also i want this alert everytime when stock is low.