Add to timeline of a document

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.

  1. Python, the backend you can use doc.add_comment.

  2. 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

1 Like

Thank you so much!:relaxed:

1 Like