I want to display the most recent comment for a record with a formula.
I have the following formula which works for records that do not have a lot of comments. It will fail when there is a lot of comments because of the character limits placed on formulas. This is very inefficient, since it has to loop through all of the comments just to get the most recent.
var buf = "";
//overwrite buf with each iteration to get the last comment in the loop
{!#LOOP_BEGIN.$COMMENT}
buf = "{!$COMMENT.content}";
{!#LOOP_END.$COMMENT}
return buf;
I can add the (1) to the loop to only loop through the first comment, but the first comment is the earliest one created, not the last one created.
var buf = "";
{!#LOOP_BEGIN.$COMMENT(1)}
buf = "{!$COMMENT.content}";
{!#LOOP_END.$COMMENT}
return buf;
1. Can I create an alternative view for the comments object to loop in descending created at order?
OR
2. Can the $COMMENT object be accessible with
I'll try to address this in the next update.