I’m trying to figure out how to use the add_timeline_item function in a client script
As can be seen in the screen shot, what is the nature of the “item” parameter? Is it a string, an object, etc?
In general, how can I use the browser’s DevTools to figure out the nature of any function’s parameters?
However, even if I save the document, the Timeline entry is not retained, but lost should I refresh the document. How can I persist the Timeline entry? It appears that
I’m guessing you’ve likely sorted this out but since this just came up in one of my searches I thought it would be worthwhile adding the following information for future viewers:
The “timeline” object is itself just a rendering of the timeline information, the entries in the timeline are transient and are generated dynamically from a combination of entries drawn from doc fields (e.g. “created” => “You created this …” and “modified” times => “You last edited this …”) and “Comment” docs. (Possibly others but that’s all I’ve looked at myself).
So when you manually add entries to the timeline you have to do that each time the form is rendered, they aren’t permanent.
For my use case I created doctype “Comment” docs setting the “reference_doctype” and “reference_docname” fields appropriately. These then get rendered in the timeline for the given doc “automatically”.
Hopefully someone will correct/update this information if needed.