how can I add comment to a doc from js? (I need to add comment to a doc on its submission, from js). I tried cur_frm.add_comment, cur_frm.cscript.add_comment, doc.add_comment, this.add_comment and none of them were recognized.
cur_frm.comments.insert_comment("Comment","My Comment")
1 Like
You can do this by writing a whitelisted function . and write code as in below in server side
d = frappe.get_doc(‘Opportunity’, name)
#to add a new comment
d.add_comment(‘Comment’,text=‘Test Comment’)
it will add a new comment ‘Test Comment’ in Opportunity and doc.name=name
1 Like