Update Portfolio Parent Link using REST API

Some fields just can't be set using the regular Jira REST API, the Portfolio Parent Link is one of those fields. Fortunately, you can easily create a script that uses the Power Scripts REST Service to do the job when the Jira API can not.

To start, we need to the script that will run when called by the REST Service. This script is actually very generic, any custom field can be set using a simple script like this:

This is an example Curl script that calls the Power Scripts REST Service to run the script.

To customize this curl script you need to do the following:

  1. update the username and password with a valid user account. This is set in the beginning after the -u parameter.
  2. Update the Jira base URL. The address format is <your_base_url>/rest/keplerrominfo/refapp/latest/async-script/runScript.
  3. Make sure the name and path of the script are correct. This is set in the "code" field in the JSON data. In this example, the script is called "updateCustomField.sil".
  4. Update the key of the issue that will be updated. This is set in the "value" field in the JSON data. In this example, the script is called "TP-123".
  5. Update the custom field ID of the Parent Link field or the name of the SIL alias was set up previously. This is passed in the "args" field array in the JSON data. In this example, the ID is "customfield_12345".
  6. Update the key that the issue should be linked to (the parent). This is the second value in the args array. In this example, the parent link is "PORT-456".