Versions Compared

Key

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

On this page:

Table of Contents

 

Excerpt

Aliases represents a powerful mechanism to indirectly refer

...

custom fields, making your scripts intention obvious.

 


The Case For Aliases

 

Addressing fields by its JIRA Jira internal name is not really nice. Nobody likes to write 'customfield_12067' instead of a meaningful variable name. This is why we allow addressing the fields by name, with the disadvantage that this may prove erroneous (field name resolution does not take into account that there are maybe more than one custom field with that name).

 

Consider the following code:

Code Block
if(isNotNull(customfield_10001) // or #{The Reported User)} if accessed by name
{
  assignee=customfield_10001; // assign the report to him or her
}

 

Image RemovedImage Added

 

In absence of comments, this code meaning is elusive, the whole purpose of the script evades from the sight of the programmer. A better variant is:

...