When you add this post-function to a transition and trigger the transition, the add-on picks the value entered in the Comment
field and adds it as a comment on the target issue(s). The Comment
to be created can be any simple text, e.g. This is a comment.
You can also use Nunjucks annotations to insert issue, transition and current user information into the comment text, using the 'issue', 'transition' and 'currentUser' variables, respectively. To find out more about the variables, see How to insert information using Nunjucks annotations.
Restrict to Group
field the specified For no restriction, leave the field blank.: from the drop-down Restrict to Project Role
field the selected project For no restriction, leave the field blank.: the To execute this post-function based on the result of a Nunjucks template see Conditional execution.Run as current user: The current user will be the author of the comment created on the issue by the post-function.
Run as add-on user: The add-on user will be the author of the comment created on the issue by the post-function.
Run as this user: Any user selected in this field will be the author of the comment created on the issue by the post-function.
Conditional execution
Save the post-function
Publish the workflow
Use case
A typical use of this workflow post-function is to comment on an issue during a transition. Consider a use where on resolving/closing a ticket you want to comment on the issue a summary of the worklog. To configure it:
Add the Comment issue post-function to the Resolve transition of the issue's workflow.
Write the following content in the Comment
section.
Code Block |
---|
{% set worklogs = issue.fields.worklog.worklogs %}
{% set count = 1%}
{% for worklog in worklogs %}
Worklog {{count}}:
Started : {{ worklog.started }}
Time Spent : {{ worklog.timeSpent }}
Work Description : {{ worklog.comment }}
{% set count = count + 1 %}
{% else %}
No work logged for this issue
{% endfor %} |