Our new Appfire Documentation Space is now live!

Take a look here! If you have any questions please email support@appfire.com

Set Component/s field from a Cascading field

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

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

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

References