Hi everyone:
I need to send a notification via slack when a comment is created for an issue.
I was able to send a message using Scriptrunner Listener "Post a message to Slack".
However, I can't send comment that has been created as part of the message.
My Code is:
<% out << currentUser?.displayName %> comentó en el ticket
https://mda.neora.com.pe/browse/${issue.key}
${issue.key}: ${issue.summary}
This works fine, but when I added the next code:
<% if (lastComment)
out << lastComment
%>
I got an error. Log shows:
groovy.lang.MissingPropertyException: No such property: lastComment for class: groovy.lang.Binding
2020-05-23 01:47:23,924 http-nio-8091-exec-17 ERROR oscar.diaz 107x2234272x1 2etzel 190.234.91.39,127.0.0.1 /rest/api/2/issue/CRO-145/comment [c.o.scriptrunner.runner.AbstractScriptListener] Script function failed on event: com.atlassian.jira.event.issue.IssueEvent, script: com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.PostMessageToChatService
2020-05-23 01:47:23,924 http-nio-8091-exec-17 ERROR oscar.diaz 107x2234272x1 2etzel 190.234.91.39,127.0.0.1 /rest/api/2/issue/CRO-145/comment [c.o.scriptrunner.runner.AbstractScriptListener]
I also have tried with:
<% if (mostRecentComment)
out << mostRecentComment
%>
But get the same error, the only difference is this part:
groovy.lang.MissingPropertyException: No such property: mostRecentComment for class: groovy.lang.Binding
I spent the last 24 hours trying to figure out how send comment via slack when a comment is created for an issue. Something that seems to be so basic, but I can't make it to work.
Please, your kindly help.
Thanks in advance,
Tito.