Getting Last comment and record it to field

Hello guys, i want to get last doc comment from timeline using scrip and record it in a field

i have tried this code but it doen’t worked.

frappe.ui.form.on('Lead', {
	refresh(frm) {
	    var x = frappe.get_list('comments', fields=['content']);
       frm.doc.last_comment = x;
     

	}
})
1 Like