Example: Add current user to comment
I'm looking for a functionality in workflow that automatically added the current user name after a user has enter a comment. Toolbox has to add: Comment was created by : Andreas Beekma
I found the "Copy a parsed text to a field" and I can copy the %{Current user} to every space in JIRA but every "comments" be ignored.
Example: "The following text parsed in basic mode will be copied to Last comment: %{Current user} This feature will be run as Current user."
You can use Copy a parsed text to a field post-function with the following configuration:
Text to be parsed in this post-function is:
%{00127} != null ? %{00109} + "\n Comment was created by: " + %{00021} : %{00109}
Note that:
- %{00127} is field code for Transition's comment
- %{00109} is field code for Last comment
- %{00021} is field code for Current user's full name
Once configured, your transition will look like this:
WARNING: Be careful to insert your post-function AFTER "Add a comment to an issue if one is entered during a transition." post-function, like shown in the former screenshot.
This solution works only for comments introduced in transition's screens, i.e., if the user insert comments by editing the issue, it won't work, since Copy a parsed text to a field post-function only works when the transition were its inserted is executed.
Another implementation
The special way to use the script in Jira service desk, it doesn't work. When I start the transition via SD Portal. In Jira SD directly it works.
There is a solution for your use case: use Copy a parsed text to a field post-function with the following configuration:
Note that:
- %{00109} is field code for "Last comment"
- %{00164} is field code for "Last commenter"
Other examples of that function
- Add all assignees of certain sub-task types to a "Multi-User Picker" custom field
- Add and remove a single or a set of items from multi valued fields
- Add current user to comment
- Add or remove request participants
- Add watchers from a part of the issue summary: "Summary_text - watcher1, watcher2, watcher3, ..."
- Assign issue based on the value of a Cascading Select custom field
- Assign issue to last user who executed a certain transition in the workflow
- Automatically close resolved sub-tasks when parent issue is closed
- Automatically reopen parent issue when one of its sub-tasks is reopened
- Calculate the time elapsed between 2 transition executions
- Close parent issue when all sub-tasks are closed
- Combine the values of several Multi-User picker fields
- Compose a parsed text including the "full name" or a user selected in a User Picker custom field
- Compose dynamic text by inserting field values in a text template
- Copy issue labels to a custom field
- Copy the value of a user property into a user picker
- Create a comment in sub-tasks when parent transitions
- Execute transition in epic
- Getting the number of selected values in a custom field of type Multi Select
- Limit the number of hours a user can log per day
- Make a sub-task's status match parent issue's current status on creation
- Make parent issue progress through its workflow
- Moving story to "In Progress" when one of its sub-tasks is moved to "In Progress"
- Moving story to "Ready for QA" once all its sub-tasks are in "Ready for QA" status
- Parse Email adresses to watchers list
- Parsing text from last comment and appending it to issue's summary
- Remove versions selected in a version picker custom field
- Replace certain issue link types with different ones
- Restrict parent issue from closing if it has sub-tasks that were created during a given parent issue status
- Set a Select or Multi-Select field using regular expression to express the values to be assigned
- Set assignee depending on issue type
- Set field depending on time passed since issue creation
- Set priority for issues that have been in a certain status for longer than 24 hours
- Set security level based on groups and project roles the reporter or creator are in
- Transition linked issues in currently active sprint
- Transition only a sub-task among several ones
- Transition parent issue only when certain issue sub-task types are done
- Update Cascading Select custom field with a value of the field in parent issue
- Update checkboxes custom field if a file has been attached during a transition
- Validation on issue attachments
- Validation on MIME types of issue attachments
- Writing a comment to blocked issues when blocking issues are resolved