Versions Compared

Key

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

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

Abstract

This code snippet sets the Component/s field from the value of a Cascading field. This is useful if you have a large number of Components that can be organized in categories, and want to make it easier for users to find the appropriate Component using a Cascading Select input (two dropdown lists).

Logic

Access the Cascading custom field and return its parent and child values separated by a delimiter (that separates the categories in the Component/s)

Snippet 

Code Block
languagejs
linenumberstrue
{% if issue.fields['<Name of the cascading field>'] %}
{{ issue.fields['<Name of the cascading field>'].value }}<Delimiter>{{ issue.fields['<Name of the cascading field>'] | field("child.value") }}
{% endif %}

Placeholders

PlaceholderDescriptionExample
<Name of the cascading field>Name of the field of type CascadingFunctional Modules
<Delimiter>Delimiter of the parent and the child value/

Examples

The output of this snippet is a String representing the name of a Component which you could use for example, to set the Component/s to Human Resources - Recruitment when Human Resources and Recruitment are selected as the parent and child in the Cascading select list, in:

  • one of the Set field value post-functions
  • the Create issue post-function under Set fields of new issue section
  • one of the Transition issue post-functions on the transition screen, if any

    Code Block
    languagejs
    linenumberstrue
    {% if issue.fields["Functional Modules"] %}
    {{ issue.fields["Functional Modules"].value }}/{{ issue.fields["Functional Modules"] | field("child.value") }}
    {% endif %}


References

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

...