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.fetches the next unreleased version available for the current issue

Logic

Check for a value on the Assignee and based on the result, assign the issue to a specific userAccess the available versions for the issue and filter the next unreleased version by the version date

Snippet

Code Block
languagejs
linenumberstrue
{% set if issue.fields.assigneevers = {} %}
{{% for <Applicationv Userin Objectissue or| aprojectInfo String representing a Username> }}| field("versions") %}
  {% if endif %}

Placeholders

...

Placeholder

...

Description

...

Example

...

(warning) You need to select "Treat as JSON" option when the script returns a user object

Examples

Code Block
languagejs
linenumberstrue
{% if issue.fields.assignee %}
{{ issue.fields.reporter.name }}not v.released and (not vers.releaseDate or vers.releaseDate >= v.releaseDate) %}
    {% set vers = v %}
  {% endif %}
Code Block
languagejs
linenumberstrue

{% if issue.fields.assignee endfor %}
{{ issue.fields.project.lead }}
{% endif %}

(warning) You need to select "Treat as JSON" option

Context

You would typically use this code:

...

vers.name}}

Placeholders

N/A

Examples

The output of this code is a String representing a Version which you could use in a template, for example, to set a Version 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
    • Run a condition
    • Run a validator
    • Unlink issues

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

References

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

...