You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
The Power Scripts add-on lets you customize your Jira Server the way you need.
You can read more about the Power Scripts add-on and its features here.
In this article will will talk about the Server and Data Center versions of this plugin.
Power Scripts uses its own language called SIL. This language hides the complexity of Jira architecture and lets you customize Jira using SIL functions, which are very easy to learn and use.
But there is also a problem, if SIL does not have a function you need, then you can not use this function.
But it is not a reason to get disappointed, you can write this function yourself using Jira Java API.
Actually there are multiple cPrime plugins, which use SIL under the hood. For example, the Power Custom Field Premium PRO add-on or the Power Database Fields PRO add-on.
You can add your own sil functions to all these plugins
In this article I will show you how to do it.
The source code for this plugin you can download here.
You need to install Atlassian SDK and after it you can execute the following command in the terminal:
This command will create a template for a Jira Server/Data Center plugin.
You will need to answer the questions in the terminal this way:
Define value for groupId: : ru.matveev.alexey.atlas.sil.extension
Define value for artifactId: : sil-extension
Define value for version: 1.0.0-SNAPSHOT: :
Define value for package: ru.matveev.alexey.atlas.sil.extension: :
Y: : Y
Your pom.xml file should look like this:
Most important parts, which I added:
1. I added the path to cPrime repository to get the SIL library. We need this library to extend the sil language:
<name>cprime maven repository</name>
2. I added dependency for the SIL library:
3. I made the SIL library be loaded during the start of our plugin:
<!-- OBR dependencies -->
1. Add a java class for our new routine:
the executeRoutine function in this file is executed all the time our new routine called. You should put your logic there.
2. Add a java class with information of your plugin:
In the getKey method you should return the key of your plugin plugin. If you return something else, then your routine will not be loaded.
3. Add a java class to load your routine to the SIL library:
Now you can start your plugin with the atlas-run command.
Atlas-run will start Jira and install your plugin in this Jira.
After Jira started you can go to the SIL manager (http://locahost:2990/jira/plugins/servlet/silmanager) and write a script like this:
string str = myReverseString(summary);
logPrint("ERROR", "summary:" + summary);
logPrint("ERROR", "reversed summary:" + str);
Now if you execute this script, you will see the following lines in the atlassian-jira.log file:
2019-01-22 17:19:28,412 pool-32-thread-9 ERROR admin 1039x571x1 1ymwhmx 0:0:0:0:0:0:0:1 /rest/keplerrominfo/refapp/latest/async-script/runScriptFromEditor [c.k.s.lang.routines.LogPrintRoutine] summary:This is your first task
2019-01-22 17:19:28,415 pool-32-thread-9 ERROR admin 1039x571x1 1ymwhmx 0:0:0:0:0:0:0:1 /rest/keplerrominfo/refapp/latest/async-script/runScriptFromEditor [c.k.s.lang.routines.LogPrintRoutine] reversed summary:ksat tsrif ruoy si sihT
That is it. You can now write your own routines for SIL and extend cPrime plugins with new features.
1,574 accepted answers