Versions Compared

Key

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

...

...

...

...

...

...

...

...

Abstract

This code snippet fetches the user who triggered the current transition.

Logic

This snippet uses the currentUser built-in variable to fetch the ApplicationUser object representing the user who triggered the current transition.

Snippet 

Code Block
languagejs
linenumberstrue
currentUser


Examples

The output of this code snippet is an ApplicationUser object representing the current user which you could use in:

...

  • Set a user picker field to the current user. Eg: Save the user who "coded" an issue into an "Implemented by" custom User Picker field for traceability and reporting purposes or Assign an issue to the current user in
    • one of the Set Field Value post-functions
    • the Create issue post-function under Set fields of new issue section
  • Conditionally execute a Post-function/Condition/Validator or Unlink issues  - Eg: Check that the current user is the Reporter of the issue

    Code Block
    languagegroovy
    linenumberstrue
    issue.get("reporter") == currentUser


A Groovy template, for example to:

  • Notify the customer that the issue raised by them is being handled by the current user through the
    • Comment in one of the Comment issue post-functions
    • Subject/HTML body/Text body of Email issue post-function

      Code Block
      languagegroovy
      linenumberstrue
      Hi <%=issue.get("reporter").getName()%>. Your issue is being handled by <%= currentUser.getDisplayName() %>


  • Write a JQL search expression in the Link issues to current issue post-function - Eg: Link issues assigned to the current user

    Code Block
    languagegroovy
    linenumberstrue
    assignee = <%= currentUser.getName() %>


References

Filter by label (Content by label)
showLabelsfalse
max5
spacesKB
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel = "groovy" and label = "jmwe-server" and type = "page" and space = "KB"
labelsjmwe-nunjucks jmwe-cloud

...