About
Script Templates are an easy way to add automated actions instantly and without any coding. We have taken some of the most common types of scripts and converted them into an easy to use interface.
However, this does not mean scripting is not used. When creating the action using a template the script gets generated for you. We do this because we firmly believe that script is the most flexible, most powerful way to incorporate automation into your Jira system. We release that not everyone is comfortable scripting so we created the templates to guide users through the process.
Contents
In the image above, you can see the script getting written in the SIL code preview panel as the user enters information into the input fields. We do this with the hope that after seeing real word applications of the scripts you will become more familiar with the way they are written and gain confidence in modifying and writing the scripts in the future.
The scripts, after being generated, are also automatically applied so that little to no experience to the administration of Jira is required. However, these templates are designed to be simple guides and continued reliance on them for Jira configuration could result in a less than optimal configuration. It is still advised that someone with more experience reviews the configuration changes after they are applied.
What happens when the template is applied?
When a template gets applied, the script that was seen in the preview window actually gets created in the system. The SIL Manager is the code editor for SIL scripts and holds the repository for all the scripts used by Power Scripts. Inside this repository you will find a folder called generated_templates. Inside this folder will be subfolders that correspond to different script types and under those you will find that actual script that was generated.
Next, a configuration must be added so that Jira knows which script corresponds to specific events or actions. For example, for a listener script to run it must be associated with an internal event within Jira. In the example below we can see which scripts correspond to events like “Issue Closed” and “User Created”.
Many configurations are found within the Power Scripts administration section of the Jira admin. However, this is not true for all of them. Some configurations, like post-functions, are added to the issues workflow. If not familiar with editing workflows this may not seem very straight forward so the configurations will get added to those workflows automatically.
Our hope is for you to then investigate the script and the configuration so you can see how these two things relate to each other and how they get configured. Our main goal is to guide you through setting up these configurations so that you can set them up without the assistance of the templates in the future.
How to make changes existing template scripts?
As mentioned above, there are script files that get created when a template is applied. This means that changes to the applied template can be made directly in those scripts so that it can be customized to your specific needs. Changing the code within a script file does not affect the configuration. This changes can be made independently without updating the workflow or any other type of configuration.
WARNING: Changing the name of a script or moving its location to a different folder will impact existing configurations since the configuration will no longer be able to locate that file. If you wish to change the name or move the file location the configuration needs to updated.
What type of templates are available?
Validator Templates
Validators will prevent the user from transitioning an issue in Jira from one status to another unless the conditions for the validation are met. Validators can be used to ensure data is entered into a custom field before the user can continue, validating the format of that data, or checking some other aspect about the user or issue before allowing the transition to complete.
The templates will create this validation process by adding a new validation script to an existing workflow transition within Jira.
Condition Templates
Conditions will prevent the user from transitioning an issue in Jira from one status to another unless the requirements for the condition are met. Conditions can be used to prevent users from starting a transition based on the requirements in the script. If a user has not met the condition the user may not ever know the transition was an available option.
The templates will create this condition process by adding a new condition script to an existing workflow transition within Jira.
Post-Function Templates
Post-functions are actions that occur after an issue is transitioned. Post-functions represent one of the largest categories of use cases for automation.
The templates will create the post-function by adding a new post-function script to an existing workflow transition within Jira.
Listener Templates
Listener scripts are extremely useful because they capture a wide range of events that occur both inside and outside of the issues workflow. Listeners can capture such things as issue edits, or the creations of new objects within Jira.
The templates will add scripts to associated events within Jira.
Recurrent (Scheduled) Job Templates
Recurrent jobs are actions that occur at specified time intervals or on specific dates. These jobs are scheduled because either there is not other trigger type that can be sufficiently used, or because of other time or performance considerations. Some jobs, like jobs to trigger reindexing, may impact the performance of Jira so these can be scheduled off hours so users are not impacted. Other jobs, may rely on external factors like operations completing on external systems before the data can be synchronized. Or, another use for scheduled jobs is to create an escalation service that raises the priority on issues that are past due.
The templates will create the recurrent job by adding a new recurrent job script and its schedule to the configuration.
Live Fields Templates
Live Fields are actions that occur when an user views one of the issues screens. These scripts allow for the control of these fields in a variety of helpful ways. They add the ability to extend the permissions control within Jira as well as helping the user by pre-populating fields or automatically controlling the field options in some other way.
The templates will create the Life Fields script by adding a new configuration for Live Fields. To learn more about using Live Fields see this page.
Custom Field Templates
Conditions will prevent the user from transitioning an issue in Jira from one status to another unless the requirements for the condition are met. Conditions can be used to prevent users from starting a transition based on the requirements in the script. If a user has not met the condition the user may not ever know the transition was an available option.
The templates will create this condition process by adding a new condition script to an existing workflow transition within Jira.
Notification Templates
Conditions will prevent the user from transitioning an issue in Jira from one status to another unless the requirements for the condition are met. Conditions can be used to prevent users from starting a transition based on the requirements in the script. If a user has not met the condition the user may not ever know the transition was an available option.
The templates will create this condition process by adding a new condition script to an existing workflow transition within Jira.
User Templates
Conditions will prevent the user from transitioning an issue in Jira from one status to another unless the requirements for the condition are met. Conditions can be used to prevent users from starting a transition based on the requirements in the script. If a user has not met the condition the user may not ever know the transition was an available option.
The templates will create this condition process by adding a new condition script to an existing workflow transition within Jira.
Will new templates be added?
Yes, from time to time new templates will be created and added to the list. The templates chosen for created will be determined by demand and specific templates can be requested for consideration through our support portal.
However, the goal of these templates is to provide you with an example of how to create a similar solution, not to necessarily take all of the work out of creating a new script and solve everyone's problems. Again, we firmly believe that scripting makes the most flexible and powerful solutions and which to guide you into becoming a SIL scripting ninja!