Skip to end of banner
Go to start of banner

Persistent Variables

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

Often, during the development of an integration or a special customization, people get stuck because of the lack of context. Questions appear: which user clicked the button for the next status? Did the manager approve this item? What was the result of the calculation in the previous step? The traditional way of dealing with such questions was to create additional custom fields to keep that data, usually hidden from users (so excluded from the screens schemes), effectively adding bloat to Jira and ultimately worsening indexing - and general - performance. To help you answer these kinds of questions, Simple Issue Language™ (or SIL™) acquired, starting with version 4.5.0 of the SIL Engine™, a new feature, called persistent variables.

A persistent variable is a value inherently linked to the issue. Think of it as an extension of the issue fields, or - making another analogy - an additional custom field, but internal to SIL™. Outside the issue context, the persistent variable becomes a global variable, accessible from all scripts. It is better to see some usage, so you can get a better grasp on what it means and how it can simplify your SIL™ usage throughout your Jira integration.

So, what's a persistent variable? In short, in an issue context, a persistent variable is a value inherently linked to the issue. Think of it as an extension of the issue fields, or - making another analogy - an additional custom field, but internal to SIL™. Outside the issue context, the persistent variable becomes a global variable, accessible from all scripts. It is better to see some usage, so you can get a better grasp on what it means and how it can simplify your SIL™ usage throughout your Jira integration.

Helper Routines

There are two helper routines available to ease your work with persistent variables. These routines allow you to set or retrieve the value of a persistent variable from a script that is not in the context of the issue or just to retrieve a global variable:

Routines

  • Page:
    setPersistentVar (Power Suite Apps for Jira) — Sets the persistent var, as a string
  • Page:
    getPersistentVar (Power Suite Apps for Jira) — Gets the persistent var, as a string

Values are treated as strings. For the above example:

string globalCounterVar = getPersistentVar("counter");
number test_one_counter = getPersistentVar("TEST-1", "counter"); //notice the implicit cast! values are treated like strings, though!
  • Although useful, persistent variables come with a small performance penalty. Don't overuse them!

  • There's no way to delete a persistent var (other than direct SQL) at the moment. Think hard if you really need them.

See More

  • No labels