How to assign value read from sql by using custom script

Hello,
We have a customization requirement for item form. Value get by using sql query defined in the server side method and assign to a field in the Item by using custom script.

Server Side Script
def item_code_query(doctype, txt, searchfield, start, page_len, filters)
return frappe.db.sql(""“SELECT item_code FROM tabItem WHERE creation=(SELECT MAX(creation) FROM tabItem)”"")

Custom Script
frappe.ui.form.on(“Item”, “onload”, function(frm) {
frm.set_query(“item_code”, function() {
return {
query: “erpnext.controllers.queries.group_item_query”,
}
});

});

But value is not showing in the field.

However when i add a link type filed, it is showing the value as list.

Please let me know how to assign this value to item_code or any custom filed.

Find solution myself with following code
Server Side

@frappe.whitelist(allow_guest=True)
def item_name_query(doctype):
    return frappe.db.sql("""SELECT `name` FROM `tabItem` WHERE creation=(SELECT MAX(creation) >FROM `tabItem`)

Client Side

frappe.call({
    		method: "erpnext.controllers.queries.item_name_query",
    		args: 	{
    				doctype:"Item"
    			},
    		callback: function(r) {
    				msgprint(r.message);				

    		}
    	});