JavaScript Workflows - get comments

Hi.

I would like to get the last comment of issue. But I don't understand what type the object ctx.issue.comments? I tried to use:

    console.log(ctx.issue.comments);

but I got 

{}

Is it an array?

1
2 comments
Official comment

Hello Dmitry,

There're some issues with string representation of objects in new workflow functionality. As for the type of the collection, it has type Set (as mentioned here: https://www.jetbrains.com/help/youtrack/standalone/2017.2/v1-Issue.html). This time is described here: https://www.jetbrains.com/help/youtrack/standalone/2017.2/v1-Set.html. So you just need to call issue.comments.last().

Regards,

  Alexander

Wow....

    ctx.issue.reporter.sendMail("New comment",ctx.issue.comments.last().text);

it works, thanks you!

1

Please sign in to leave a comment.