Frappe msgprint Error

Hi everyone i’m trying to print a message using frappe.msgprint when an item is out of stock which will be associated with a link to item with insufficient stock .
The message is generated but the problem is the link is not replaced by the item code value.
Image of the message

Here is the msgprint code on the client side

frappe.msgprint(__('Print Failure Insufficient Stock for Item:<a href="/desk#Form/Item/{0}">{0}</a> ', [frm.doc.sal_flagged_item]));

Any help would be much appreciated, Thank you.

This is because the field sal_flagged_item was not found, it is either spelt incorrectly or not referenced properly. Keep in mind that you cannot access this field directly if it belongs to a child table.

Thanks for the reply @walstanb i have been doing further tracing the field is spelt correctly but for some reason it’s value is undefined which means the value was not set but i can’t figure out why it’s that way because the function to set the value is called on refresh
here is the full js

frappe.ui.form.on('Pick List', {
	refresh: function(frm){
		//Code for custom cancel button that saves cancel reason first
		if(frm.doc.docstatus == 1){;"Cancel"), function(frm) {;
		if(frm.doc.docstatus == 0 && frm.doc.__islocal == 1){
			frm.set_value('print_date_time', '');
			frm.set_value('track_print_user', '');
			frm.set_value('pl_text', '');
			//frm.set_value('sal_flagged_item', '');


		dashboard_pick_list_doctype(frm, "Sales Order");

	on_submit: function(frm){
		if (frm.doc.sal_flag_qty != 1) {
			var new_url = window.location.origin + "/printview?doctype=Pick%20List&name=" + + "&trigger_print=1&format=Pick%20List%204*6&no_letterhead=0&_lang=en"
			frappe.msgprint(__('Print Failure Insufficient Stock for Item:<a href="/desk#Form/Item/{0}">{0}</a> ', [frm.doc.sal_flagged_item]));
			console.log("Working:" + frm.doc.sal_flagged_item)
	before_cancel_event: function(frm){
			{'fieldname': 'cancel_reason', 'fieldtype': 'Small Text', 'label': 'Enter Reason', 'reqd': 1}
				'method': 'metactical.custom_scripts.pick_list.pick_list.save_cancel_reason',
				'args': {
					'docname': cur_frm.docname,
					'cancel_reason': values.cancel_reason
				'callback': function(r){
		'Please reason for cancellation.',

var get_undelivered_pick_list = function (frm) {
	var count = 0;
	var locations = frm.doc.locations;
			'method': 'metactical.custom_scripts.pick_list.pick_list.get_undelivered_pick_list',
			'args': {
				'item_code': row.item_code,
				'warehouse': row.warehouse,
			'callback': function(r){
				var items = [];
				$.each((r.message), function(i, d){
				set_qoh_flag(frm, items);


// set qoh
var set_qoh_flag = function(frm, items){
	var undelivered_pick_list = [];
		if ((row.actual_qty - row.reserved_qty) < 0){
			frm.doc.sal_flag_qty = 1;
			//frappe.model.set_value('sal_flagged_item', row.item_code)
			frm.doc.sal_flagged_item = row.item_code;


The correct field name was sal__flagged_item just missed it, Thank you very much

1 Like