Add current user by enter a comment

Issue #146 resolved
Former User created an issue

Hi Fidel, 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.

What I do wrong ?

Example: "The following text parsed in basic mode will be copied to Last comment: %{Current user} This feature will be run as Current user."

Comments (7)

  1. Fidel Castro Armario repo owner

    Hi Andreas,

    You can use "Copy a parsed text to a field" post-function with the following configuration:

    conf-1.png

    Text to be parsed in this post-function is:

    %{00127} != null ? %{00109} + "\n Comment was created by: " + %{00021} : %{00109}
    

    Where:

    • %{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:

    conf-3.png

    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.

  2. Fidel Castro Armario repo owner

    Hi Andreas, just released version 2.1.33 fixes a bug in "Transition's comment" virtual field. Please, try this new version, and let me know it it solves this issue.

  3. Fidel Castro Armario repo owner

    Sorry, Andreas, I confused "Transition's attachments" with "Transition's comment". The bug fixed in version 2.1.33 affected to "Transition's attachments".

  4. Former User reporter

    Hi Fidel. I test it with the new version and it's works.

    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. see atchment.

  5. Fidel Castro Armario repo owner

    Hi Andreas,

    Sorry for the delay in my response. There is a solution for your use case: use "Copy a parsed text to a field" post-function with the following configuration:

    conf-0.png

    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"

    Regards,

    Fidel

  6. Log in to comment