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.
Go to Jira administration > Manage apps > SIL Manager.
Select 'SIL Aliases' tab on the right-hand side of the SIL Manager window and click the '+' icon to add a new entry.
Add the following aliases:
Alias | Custom Field |
---|---|
absenceType | Absence Type |
reason | Reason/Comment |
manager | Manager/Approver |
startDate | Start date |
endDate | End date |
Once done adding aliases, the mapping will be displayed as pairs of aliases and respective custom field IDs.
Creating file tree
Navigate to Jira administration > Manage apps > SIL Manager.
Right-click on the 'silprograms' folder, click 'New', and select 'File'.
Name it "createFiles.sil" and click the tick to apply changes.
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); }
Click on a green button to run the code.
You should see the following confirmation afterward.Right-click on the 'silprograms' folder again and hit 'Refresh'.
The following folder tree along with some empty script files should be created.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)
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.
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))
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.
Hit '⌘ + f' (for Mac) to use the search and type customfield_XXXXX. There should be 5 items found.
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 |
---|---|
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.
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 |
---|---|
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)
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.
Make sure to save the changes.
You should be presented with a green 'Save done' text afterward.
types.csv (download file)
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.
Make sure to save the changes.
You should be presented with a green 'Save done' text afterwards.
structs.incl (download file)
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.
Click on a green button to run the code.
You should see the following confirmation afterwards.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))
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.
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.
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.
Make sure to save the changes.
You should be presented with a green 'Save done' text afterward.