Persistent variables
What is a persistent variable
A persistent variable in a SIL script retains its value after the script has completed execution. The stored value can be accessed by other scripts run at a later time.
What are persistent variables used for
During the development of integrations or customizations, developers often face challenges due to a lack of context. Questions arise, such as:
Which user triggered the status transition?
Did the manager approve this item?
What was the outcome of the previous calculation?
The typical approach to addressing these questions is to create additional custom fields to store the information and then exclude these custom fields from the screen schemes so that users don’t see them. While this approach may work, it adds unnecessary complexity, slows down search performance, and reduces the system's overall efficiency.
Using persistent variables provides a more flexible solution. This method preserves important data without creating additional custom fields, maintaining the system's speed and simplicity.
This is just one example of how persistent variables can be used. They can store a wide range of data, from authentication credentials to file paths used across multiple scripts, making them a powerful tool for managing and reusing critical information while maintaining system performance.
What are the different types of persistent variables
Persistent variables come in two types based on their context:
In an issue context: These variables store values specific to individual issues, functioning similarly to custom fields. Their values change from one issue to another.
Out of an issue context: These variables maintain consistent values across all issues, acting as global variables. Their values remain constant regardless of which issue you're working with.
See More