Versions Compared

Key

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

Abstract

This code snippet assigns the issue to a specific user if the issue is unassigned.

...

Placeholder

Description

Example

<Application User Object or String representing a Username>User object or username of the specific user{{ issue.fields.project.lead }} or {{ issue.fields.project.lead.name }}

Context

The output of this snippet is an ApplicationUser or a String representing a username which you can use to set a field of User type in Set field value and Set field value of linked issues post-function.

Use cases

(warning) Select "Treat as JSON" when the script returns a user object

Examples

Code Block
languagejs
linenumberstrue
{% if issue.fields.assignee %}
{{ issue.fields.reporter.name }}
{% endif %}


Code Block
languagejs
linenumberstrue
{% if issue.fields.assignee %}
{{ issue.fields.project.lead }}
{% endif %}

Context

You would typically use this code:

  • To set a User picker field in :
    • one of the Set Field Value post-functions
    • one of the Transition issue post-functions on the transition screen, if any
    • the Create issue post-function under Set fields of new issue section
  • To include the User in the
    • Comment in one of the Comment issue post-functions
    • Subject/HTML body/Text body of Email issue post-function
    • JQL search expression of Link issues current to issue
  • In a conditional execution script to
    • Run a post-function for a specific user
    • Unlink issues with a specific user

Use cases

A typical use case would be to assign the issue to the Project lead if it is unassigned - Assign the issue to the Project lead, if the issue is unassigned on creation

Reference

...