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.get("<Name of the Cascading field>"))
{
  issue.get("<Name of the Cascading field>").get(null).getValue() + "<Delimiter>" + issue.get("<Name of the Cascading field>").get("1")
}

Placeholders

PlaceholderDescriptionExample
<Name of the cascading field>Name of the field of type Cascading

Functional Modules

<Delimiter>Delimiter of the parent and the child value/

Examples

The output of this snippet is a String representing a Component name which you could use in a Groovy expression, 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

    Code Block
    languagejs
    linenumberstrue
    if(issue.get("Functional Modules"))
    {
      issue.get("Functional Modules").get(null).getValue() + "-" + issue.get("Functional Modules").get("1")
    }


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

...