Power Scripts™ for Jira

Power Hour Bootcamp Training Series

Get Started

Are you ready…

For your Jira to be in the best shape of its life? Below are 5 decks that will show you the ins-&-outs of how to maximize Power Scripts™ for your needs. After completing all 5 sections, there are exercises with scripts for you to practice and master your new knowledge.

Ready? Let’s do this.

 

 

 

 

 

 

 

 

In this section, you’ll learn about our scripting language, Simple Issue Language® (SIL®), and how it interacts with variables, data types, arrays, structs, custom fields types, comments, operators, conditionals, additional statements, routines, and more.

Part 1 >

 

 

 

 

 

 

 

 

 

Get ready to see what some real power can do. This section teaches you the functions of Power Scripts™ for Jira that’ll make you a mean, lean, Jira customization machine. Such as workflow – conditions, validators, and post functions, scheduled services, event listeners, live fields, script gadgets, and REST Service.

Part 2 >

 

 

 

 

 

 

 

 

 

In this section, you’ll learn the basics of post functions, routines, and listeners. Discover different routines powered by SIL® and Power Scripts™ for Jira like Live Fields routines, Agile board routines, Service Desk routines, Mail handler routines, Listener routines, and SIL® Runner Gadget routines.

Part 3 >

 

 

 

 

 

 

 

 

 

Now that you have the basics, prepare yourself to be fully integrated with scheduling routines and running scripts with issue context. You’ll also learn about structures with custom fields and integrate them in LDAP, Database, Email, Slack/Stride. SFDC, HTTP/REST, and or System.

Part 4 >

 

 

 

 

 

 

 

 

 

Live Fields! This is one of the most powerful features in Power Scripts™ for Jira. Learn how to master it correctly, and you can do a lot with UI manipulation including the standard and custom fields in Jira, the custom fields provided by our apps, and certain other graphic elements like buttons, tabs, and so on.

Part 5 >

BOOTCAMP & SCRIPT EXERCISES

Now, with great power comes great responsibility. Practice your new skills to harness that power.

Here’s 7 Bootcamp and bonus exercises to practice your new skills. See the scripts below to each correlating exercise.

Practice makes perfect > 

EXERCISE 1

  1. return #{TP-1}.description;
  2. string desc = “Hello, this text was programmatically added from Power Scripts by ” + currentUser() + ” on ” + currentDate() + ” and now they have the *POWER*!”;
    #{TP-1}.description = desc;
  3. string issue = “TP-1”;
    runnerLog(“Summary: ” + %issue%.summary);
    runnerLog(“Description: ” + %issue%.description);
    runnerLog(“Assignee: ” + %issue%.assignee);
    runnerLog(“Created Date: ” + %issue%.created);
    runnerLog(“Key: ” + issue);
  4. string [] issuesToTest = selectIssues(argv[0]);
    for (string issue in issuesToTest) {
    runnerLog(issue + ” – ” + %issue%.summary);
    }
  5. Bonus:
    string jql = gadget_getSingleValue(argv, “JQL”);
    string [] issuesToTest = selectIssues(jql);
    for (string issue in issuesToTest) {
    runnerLog(issue + ” – ” + %issue%.summary);
    }
  6. return “Hello World!”;
  7. gadget_createTextArea(“JQL”, “Required text”, 5, true, “Enter the JQL for the issues you wish to select.”);

 

EXERCISE 2

  1. string k = “TP-1”;
    string [] c = {“Red”, “Blue”, “Purple”};%k%.customfield_11113 = c;
  2. string k = “TP-1”;
    string c = “Banana”;%k%.fruit = c;
  3. Bouns:
    string k = “TP-1”;
    string [] c = {“Yellow”, “Green”};
    %k%.colors = c;
  4. Setup:
    string cf = admCreateCustomField(“Fruit”, “”, “Select List (single choice)”, “”, “”, “”);
    admAddCustomFieldOption(“Apple”, cf);
    admAddCustomFieldOption(“Banana”, cf);
    admAddCustomFieldOption(“Grape”, cf);
    admAddCustomFieldOption(“Kiwi”, cf);
    admAddCustomFieldOption(“Strawberry”, cf);
    admAddCustomFieldOption(“Watermelon”, cf);admAddCustomFieldAlias(cf, “fruit”);cf = admCreateCustomField(“Colors”, “”, “Select List (multiple choices)”, “”, “”, “”);
    admAddCustomFieldOption(“Red”, cf);
    admAddCustomFieldOption(“Orange”, cf);
    admAddCustomFieldOption(“Yellow”, cf);
    admAddCustomFieldOption(“Green”, cf);
    admAddCustomFieldOption(“Blue”, cf);
    admAddCustomFieldOption(“Purple”, cf);


EXERCISE 3 

  1. string errorMsg = “Only members of the Validators group can perform this action”;if(isUserInGroup(“Validators”, currentUser()) == false) {
    return false, errorMsg;
    }
  2. string project = “TP”;
    string parent = key;
    string type = “Sub-task”;
    string summary = “I made this!”;
    string priority = “High”;
    string description = “This issue was made with Power Scripts”;
    string [] components;
    date due_date;
    interval estimate;
    string security;
    string [] cf;interval time = “2w”;
    due_date = currentDate() + time;string newKey = createIssue(project, parent, type, summary, priority, description, components, due_date, estimate, security, cf);
  3. string errorMsg = “Only the king can perform this action”;if(currentUser() != “epresley”) {
    return false, errorMsg;
    }
  4. string errorMsg = “Only the king can perform this action”;if(currentUser() == “epresley”) {
    return false, errorMsg;
    }


EXERCISE 4

  1. string [] subtasks = subtasks(key);for(string s in subtasks) {if(%s%.status != “Done”) {
    autotransition(“Done”, s, true, true, true);
    }
    }

 

EXERCISE 5

  1. 0 0 2 1/1 * ? *
  2. string path = “C:\\Program Files\\Atlassian\\Application Data\\JIRA\\silprograms\\log.txt”;function writeLog(string message)
    {
    printInFile(path, message);
    return true;
    }
  3. include “C:\\Program Files\\Atlassian\\Application Data\\JIRA\\silprograms\\log.incl”;writeLog(“Reindexed on ” + currentDate());admReindex();


EXERCISE 6 

  1. string [] keys = selectIssues(“project= ” + argv[0] + ” and resolution= “+ argv[1]);
    string [] ret;for(string k in keys) {string [] subtasksKeys = subtasks(k);
    for(string sk in subtasksKeys) {
    if(%sk%.status == argv[2]) {
    ret += k;
    }
    }
    }return ret;
  2. string [] keys = selectIssues(“attachments is not EMPTY”);
    string [] ret;
    for(string k in keys) {
    string [] attachments = %k%.attachments;
    for(string a in attachments) {
    if(contains(a, argv[0])) {
    ret += k;
    }
    }
    }
    return ret;


EXERCISE 7 

  1. if(argv[“Fruit”] == “Apple”) {
    lfShow(“Color”);
    lfSet(“Color”, {“Red”});
    }
    else if(argv[“Fruit”] == “Banana”) {
    lfShow(“Color”);
    lfSet(“Color”, {“Yellow”});
    }
    else if(argv[“Fruit”] == “Grape”) {
    lfShow(“Color”);
    lfSet(“Color”, {“Purple”});
    }
    else if(argv[“Fruit”] == “Kiwi”) {
    lfShow(“Color”);
    lfSet(“Color”, {“Green”});
    }
    else if(argv[“Fruit”] == “Strawberry”) {
    lfShow(“Color”);
    lfSet(“Color”, {“Red”});
    }
    else if(argv[“Fruit”] == “Watermelon”) {
    lfShow(“Color”);
    lfSet(“Color”, {“Green”});
    }
    else {
    lfHide(“Color”);
    }
  2. lfHide(“Color”);
    lfWatch(“Fruit”, {“Fruit”}, “TP_hook.sil”, {“change”});Create a new file in the SIL Manager named TP_hook.sil

 

 

Ready for a pulse check? Install Health Reports for Jira to see in a matter of minutes the health of your Jira.

Call Now Button