Scripts setup

Config summary

Here's what you will have after completing this guideline:

  • SIL aliases mapped with custom fields;

  • Workflow and Absences scripts ready. 

Required permissions

Requires either Jira System Administrators or Jira Administrators global permission. If you don't have such privileges, ask your Jira administrator for help.

Adding SIL aliases

SIL aliases are a mapping between a nickname and a custom field id. This makes the scripts easier to read and protects them from breaking if someone renames a custom field. 

The following SIL aliases need to be added for each of the custom fields used by this integration. In order to do that, follow the steps below.

  1. Go to Jira administration > Manage apps > SIL Manager.

  2. Select 'SIL Aliases' tab on the right-hand side of the SIL Manager window and click the '+' icon to add a new entry. 

  3. Add the following aliases: 

Alias

Custom Field

Alias

Custom Field

absenceType

Absence Type

reason

Reason/Comment

manager

Manager/Approver

startDate

Start date

endDate

End date

48.png

Once done adding aliases, the mapping will be displayed as pairs of aliases and respective custom field IDs.

93.png

Creating file tree

  1. Navigate to Jira administration > Manage apps > SIL Manager.

  2. Right-click on the 'silprograms' folder, click 'New', and select 'File'. 

  3. Name it "createFiles.sil" and click the tick to apply changes. 

  4. Copy the below code and paste it over to the script field. 

    createDirectory("BigPicture"); createDirectory("BigPicture/Absences");   string [] files = "functions.incl|structs.incl|types.csv"; for(string f in files) {     createFile("BigPicture/Absences/" + f); }   createDirectory("BigPicture/Absences/Workflow");   files = "assignManager.sil|recordAbsence.sil|validator.sil"; for(string f in files) {     createFile("BigPicture/Absences/Workflow/" + f); }
  5. Click on a green button to run the code. 


    You should see the following confirmation afterward.

     

  6. Right-click on the 'silprograms' folder again and hit 'Refresh'. 


    The following folder tree along with some empty script files should be created.

  7. Use the right click and the 'Delete' option to remove the 'createFiles.sil' script as it is no longer needed. Click 'OK' when prompted to confirm the action. 

     

Configuring Workflow and Absences scripts

Each script can be opened e.g. in TextEdit (for Mac) or any other text editor.

assignManager.sil (download file)

  1. Once opened in a text editor, copy the script text and paste it into the corresponding file from under the 'Workflow' folder in the SIL Manager. 



  2. Make sure to save the changes.


    You should be presented with a green 'Save done' text afterwards.

recordAbsence.sil (download file (BigPicture 8.0.X - 8.2.X) | download file (BigPicture 8.3.X and later))

  1. Once opened in a text editor, copy the script text and paste it into the corresponding file from under the 'Workflow' folder in the SIL Manager. 



  2. Hit '⌘ + f' (for Mac) to use the search and type customfield_XXXXX. There should be 5 items found.  

     

  3. Click on the 'SIL Aliases' tab on the right. Then, for each of the custom fields from the code lines below, find their ids and swap with XXXXX in the script code.

Code line

SIL alias

Code line

SIL alias

date start = toTimeZone(customfield_XXXXX, "GMT+1")

startDate

a.typeId = types[customfield_XXXXX].id

absenceType

a.startDate = formatDate(toTimeZone(customfield_XXXXX, "GMT+1"), dateFormat)

startDate

a.endDate = formatDate(toTimeZone(customfield_XXXXX, "GMT+1"), dateFormat)

endDate

a.comment = customfield_XXXXX

reason


For example, for Start date, this should look like below. 

  1. Once you have these XXXXXs all swapped with custom field ids, save the script.

    You should be presented with a green 'Save done' text afterward.

Code line

SIL alias

Code line

SIL alias

date start = toTimeZone(customfield_XXXXX, "GMT+1")

startDate

a.typeId = types[customfield_XXXXX].id

absenceType

a.startDate = formatDate(toTimeZone(customfield_XXXXX, "GMT+1"), dateFormat)

startDate

a.endDate = formatDate(toTimeZone(customfield_XXXXX, "GMT+1"), dateFormat)

endDate

a.comment = customfield_XXXXX

reason

validator.sil (download file)

  1. Once opened in a text editor, copy the script text and paste it into the corresponding file from under the 'Workflow' folder in the SIL Manager.

     

  2. Make sure to save the changes.

    You should be presented with a green 'Save done' text afterward.

     

types.csv (download file)

  1. Once opened in a text editor, copy the text and paste it into the corresponding file from under the 'Absences' folder in the SIL Manager.

  2. Make sure to save the changes.

    You should be presented with a green 'Save done' text afterwards.

structs.incl (download file)

  1. Once opened in a text editor, copy the script text and paste it into the corresponding file from under the 'Absences' folder in the SIL Manager.



  2. Click on a green button to run the code.  


    You should see the following confirmation afterwards.

  3. Make sure to save the changes.

    You should be presented with a green 'Save done' text afterwards.

functions.incl (download file (BigPicture 8.0.X - 8.2.X) | download file (BigPicture 8.3.X and later))

  1. Once opened in a text editor, copy the script text and paste it into the corresponding file from under the 'Absences' folder in the SIL Manager.

  2. In the highlighted two lines, swap the default credentials (dastin/Pas$$word) with the username and password of a Jira user that will be used to make the REST calls to BigPicture. 

    Info: It is recommended that a new Jira user with Jira System Administrators or Jira Administrators global permission be created as a service account so that password changes do not impact the functionality of this script.

    For the purpose of this user manual, we used Jira admin account. 

  3. Click on a green button to run the code.  

    You should see the following confirmation afterwards.

    Once this script has been run successfully for the first time the username and password used will be stored permanently as a persistent variable. This can be seen in the 'Persistent vars' tab on the right-hand side of the SIL Manager.

    As soon as you confirm that these are stored there, you can modify the script so that the credentials are not visible in the code itself. For this, we used getPersistentVar routine.

  4. Make sure to save the changes. 

  5. You should be presented with a green 'Save done' text afterward.