I have a custom button in one of my doctype and each time a user clicks on it, I want to log it in the timeline of that specific document.
Please guide.
Hello. You can do It on Python or Javascript.
-
Python, the backend you can use doc.add_comment.
-
Javascript, sadly I can’t find any documentation (sadly frappe framework docs are very lacking) but playing with the Browser console I found:
cur_frm.timeline.insert_comment('This is a very cool comment')
Will post your comment and you won’t need to refresh.
Remember that when writing form script use frm
instead of cur_frm
, is more relaiable. You can read more about Form Scripts, on the Official documentation
Thank you so much!
1 Like