Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
maxLevel1

Features used to implement the example



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:

Text to be parsed is: matches(%{00109}, ".*Comment was created by:.*") ? %{00109} : %{00109} + "\n Comment was created by: " + %{00164}


Note that:

  • %{00109} is field code for "Last comment"
  • %{00164} is field code for "Last commenter"


Other examples of that function

Incoming Links
pageCopy parsed text to a field
labelsexample

Related Usage Examples

Content by Label
showSpacefalse
cqllabel = "example" and label = "post-function"