Message Print custom script

I tried use this custom script code

 frappe.ui.form.on("Sales Order Item", {
            	onsubmit: function(frm) {
            		if(frm.doc.projected_qty < 0){

to display warning message to user for stock shortage but it’s not working


Try following script, it is working

frappe.ui.form.on("Sales Order Item", "item_code", function(frm, cdt, cdn){
	frappe.after_ajax(function() { 
		var d = locals[cdt][cdn];
			msgprint("Projected Qty is <=0");

This code should put under Sales Order type

please avoid opening multiple threads for the same issue

I’m sorry i’ll take care about that