---
title: "Scripts setup."
canonical: "https://support.appfire.com/space/DLP/297603986/Scripts%20setup."
format: markdown
---
> ℹ️ ### 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.   
> Macro (inline-media-image)
3. Add the following aliases:

| Alias | Custom Field |
| --- | --- |
| absenceType | Absence Type |
| reason | Reason/Comment |
| manager | Manager/Approver |
| startDate | Start date |
| endDate | End date |

> ℹ️ It may happen for your Jira instance to have more than one field named *Start date* or *End date*. In this case, identifying the right ids of BigPicture Start and End date fields from the 'SIL Aliases' tab will rather be tedious. Instead, you may use the following method.
> ℹ️ 
> ℹ️ - Go to Jira administration > Issues > Custom fields.
> ℹ️ - Search for the date field (look for description *field used by SoftwarePlant plugins*).
> ℹ️ - Click on the cog wheel icon and hover over 'Configure'. The custom field id should show up in the address at the very bottom of the page.

![48.png](media://5df87d85-1f71-49dc-b739-c44e70aa16f7)

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

![93.png](media://4ac03795-02c0-4c65-923c-8ccad59c11a2)

## 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 "<span style="color: #172b4d">createFiles.sil" and click the tick to apply changes. </span>
4. <span style="color: #172b4d">Copy the below code and paste it over to the script field. </span>
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

<span style="color: #172b4d">Each script can be opened e.g. in </span><span style="color: #172b4d">*TextEdit*</span><span style="color: #172b4d"> (for Mac) or any other text editor.</span>

![image](media://8cface8b-94ee-4ad4-86a1-c46dcae2136c)

### assignManager.sil ([download file](/wiki/download/attachments/296978730/assignManager.sil?version=1&modificationDate=1683036527404&cacheVersion=1&api=v2))

1. <span style="color: #172b4d">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. </span>
  
2. <span style="color: #172b4d">Make sure to save the changes.</span>
  <span style="color: #172b4d">You should be presented with a green 'Save done' text afterwards.</span>

### recordAbsence.sil ([download file (BigPicture 8.0.X - 8.2.X)](/wiki/download/attachments/296978730/recordAbsence.sil.txt?version=1&modificationDate=1683036527517&cacheVersion=1&api=v2) | [download file (BigPicture 8.3.X and later)](https://wiki.softwareplant.com/download/attachments/330555654/recordAbsence.sil?api=v2))

1. <span style="color: #172b4d">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.</span><span style="color: #172b4d">** **</span>
  
2. <span style="color: #172b4d">Hit '</span><span style="color: #4d5156">⌘ + f' (for Mac) to use the search and type </span><span style="color: #4d5156">*customfield_XXXXX*</span><span style="color: #4d5156">. There should be 5 items found.  </span>
  
3. <span style="color: #172b4d">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 </span><span style="color: #4d5156">swap with </span><span style="color: #4d5156">*XXXXX*</span><span style="color: #4d5156"> in the script code. </span>

| Code line | SIL alias |
| --- | --- |
| <sup>date start = toTimeZone(customfield_XXXXX, "GMT+1")</sup> | startDate |
| <sup>a.typeId = types[customfield_XXXXX].id</sup> | absenceType |
| <sup>a.startDate = formatDate(toTimeZone(customfield_XXXXX, "GMT+1"), dateFormat)</sup> | startDate |
| <sup>a.endDate = formatDate(toTimeZone(customfield_XXXXX, "GMT+1"), dateFormat)</sup> | endDate |
| <sup>a.comment = customfield_XXXXX</sup> | reason |

  
<span style="color: #4d5156">For example, for </span><span style="color: #4d5156">*Start date*</span><span style="color: #4d5156">, this should look like below. </span>

![45.png](media://ef4be5ed-e512-43d5-aa56-76c73c38cb94)

4. <span style="color: #4d5156">Once you have these </span><span style="color: #4d5156">*XXXXX*</span><span style="color: #4d5156">s all swapped with custom field ids, save the script.</span>
  <span style="color: #4d5156">You should be presented with a green 'Save done' text afterward.</span>

| Code line | SIL alias |
| --- | --- |
| <sup>date start = toTimeZone(customfield_XXXXX, "GMT+1")</sup> | startDate |
| <sup>a.typeId = types[customfield_XXXXX].id</sup> | absenceType |
| <sup>a.startDate = formatDate(toTimeZone(customfield_XXXXX, "GMT+1"), dateFormat)</sup> | startDate |
| <sup>a.endDate = formatDate(toTimeZone(customfield_XXXXX, "GMT+1"), dateFormat)</sup> | endDate |
| <sup>a.comment = customfield_XXXXX</sup> | reason |

### <span style="color: #4d5156">validator.sil (</span><span style="color: #4d5156">[download file](/wiki/download/attachments/296978730/validator.sil.txt?version=1&modificationDate=1683036527636&cacheVersion=1&api=v2)</span><span style="color: #4d5156">)</span>

1. <span style="color: #172b4d">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.</span>
  
2. <span style="color: #172b4d">Make sure to save the changes.</span>
  <span style="color: #172b4d">You should be presented with a green 'Save done' text afterward.</span>
  

### <span style="color: #172b4d">types.csv (</span><span style="color: #172b4d">[download file](/wiki/download/attachments/296978730/types.csv?version=1&modificationDate=1683036527738&cacheVersion=1&api=v2)</span><span style="color: #172b4d">)</span>

1. <span style="color: #172b4d">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.</span>
2. <span style="color: #172b4d">Make sure to save the changes.</span>
  <span style="color: #172b4d">You should be presented with a green 'Save done' text afterwards.</span>

### <span style="color: #172b4d">structs.incl (</span><span style="color: #172b4d">[download file](/wiki/download/attachments/296978730/structs.incl?version=1&modificationDate=1683036527897&cacheVersion=1&api=v2)</span><span style="color: #172b4d">)</span>

1. <span style="color: #172b4d">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.</span>
  
2. Click on a green button to run the code.
  You should see the following confirmation afterwards.
3. <span style="color: #172b4d">Make sure to save the changes.</span>
  <span style="color: #172b4d">You should be presented with a green 'Save done' text afterwards.</span>

### <span style="color: #172b4d">functions.incl (</span><span style="color: #172b4d">[download file (BigPicture 8.0.X - 8.2.X)](/wiki/download/attachments/296978730/functions.incl.txt?version=1&modificationDate=1683036527996&cacheVersion=1&api=v2)</span><span style="color: #172b4d"> | </span><span style="color: #172b4d">[download file (BigPicture 8.3.X and later)](https://wiki.softwareplant.com/download/attachments/330555654/functions.incl?api=v2)</span><span style="color: #172b4d">)</span>

1. <span style="color: #172b4d">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.</span>
2. In the highlighted two lines, swap the default credentials (*dastin*/*Pas$$word*) with <span style="color: #172b4d">the username and password of a Jira user that will be used to make the REST calls to BigPicture. </span>
  :info: **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.
  <span style="color: #172b4d">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 '</span>Persistent vars' tab <span style="color: #172b4d">on the right-hand side of the SIL Manager.</span>
  <span style="color: #172b4d">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.</span>
4. <span style="color: #172b4d">Make sure to save the changes. </span>
5. <span style="color: #172b4d">You should be presented with a green 'Save done' text afterward.</span>