How can we show the last comment of doc in alert?

While opportunity followup, we need to show the last comment in email alert. Can someone guide how to do that?

Not sure if this is easy. Try this if it works (not sure)

json.parse(doc.__comments)[-1]["comment"]

Thanks for suggestion. But, it’s not working.

A simple solution can be - “comment” to be mailed to persons to whom doc is shared. Please advise.

turned out to be trickier than i thought.

Dear Rushabh,

Thank you very much.

“Sending every comment (when added) to shared list” is not a simple
solution? (Sending the same through compose mail is very lengthy process.
And users may forget or avoid just because of steps involved.) This feature
is very-very useful during followups and keeping entire team in sync.
Honestly speaking, our entire team was very much conversant (and fond of
also) with this feature in odoo; and currently our internal communication
is perceptively disturbed in absence of it. (Just to remind you that we
have recently switched over from odoo to erpnext).

In fact, we had requested for the subject requirement (comment in alert) as
a work-around solution to above.

Thanking you,

With Regards,
Deven Shah
Safeworld Systems Pvt Ltd
M - 09825060116

Thank you for adding code for getting last comment in “Message Example”.

We are getting the comments in email alert for all types of docs (i.e opportunity, customer, etc). But, not getting the same for ToDo. Please advise.

(We have checked for ToDo having multiple posts also).

Nice. Just tried this. It works when my document is save.
How do I make this work when the comment is added without any need to save the doc?
I suspect something to do with methods but not sure what yet. Learning gradually.
This feature is awesome.

Thanks for adding it.