Starting with version 4.1.7 of the SIL Engine we are happy to introduce the Persistent Variables feature. We are really excited to introduce this new feature which is available in both Power Scripts for Jira and Power Scripts for Confluence as we know how sought after it is in the Atlassian Community.
A Persistent variable is a value inherently linked to a specific issue or it can be a global value. It is like an extension of the issue fields, or an additional custom field, but internal to SIL™.
Outside the issue context, the persistent variable becomes a global variable which opens up a world of possibilities as global variables can be shared and are accessible from all scripts. Even if instances need to be restarted, persistent variables will remain in the system and will not need to be rewritten.
Persistent variables are introduced via the persistent keyword. You cannot have persistent and constant modifiers used on the same variable. A persistent variable is always modifiable.
The usage outside the issue context is the same. However, due to the nature of the persistent keyword, the variable becomes a global variable.
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:
setPersistentVar(Simple Issue Language™) — Sets the persistent var, as a string
Need some inspiration for how to use Persistent Variables in Jira? Why not try the following suggestions:
Persistent Variables are even MORE exciting in Confluence as currently, Confluence does not even have custom fields with which to fabricate the effects of Persistent Variables today.
The Persistent Variable in Confluence can be created:
With the help of certain script you can add a persistent variable counter to any page to act as a page view counter.
Notes:
2. To use the script, you have to add a SIL™ Script macro, that executes a SIL™ script with persistent page counter.
3. That's it, it returns 0 on your Page.
4. If you refresh the page the counter will be incremented because the script is executed again and persistent variable is updated. So, as long as the script is executed again, and again, this persistent variable is updated. It is the one which actually executes in the context of the page.
This use case can easily be inserted so Confluence page admins can see which pages are popular and which are not. They can then use this information to showcase "trending/ most popular pages" or archive pages which are not relevant anymore.
As the saying goes, "persistence is key!" so now you can go forth and reach previously uncharted Jira and Confluence heights thanks to our new Persistent Variables!
Michele Lim [Cprime]
Product Marketing Manager
Cprime
San Francisco
1 accepted answer
0 comments