Hi Tbielejeski,
I took a look at your code and an example JSON and I think I found the issue. The work items you are looking for are actually outside of BuildInformation inside of another section called WorkItems(Workitems are in both places, but empty within BuildInformation).
Here is an example of how Octopus.Deployment.Changes is structured. It will show why you are finding the item you’re referencing is empty.
[
{
"Version": "2020.05.15.97",
"ReleaseNotes": "\n- randomquotes-js 1.0.200515.1333\n\n - [RQJ-2](https://octopussamples.atlassian.net/browse/RQJ-2) - Jeremy Miller, comment for issue\n\n",
"BuildInformation": [
{
"PackageId": "randomquotes-js",
"Version": "1.0.200515.1333",
"BuildEnvironment": null,
"BuildNumber": 140,
"BuildUrl": "https://bitbucket.org/octopussamples/randomquotes-js/addon/pipelines/home#!/results/140",
"Branch": "master",
"VcsType": "Git",
"VcsRoot": "http://bitbucket.org/octopussamples/randomquotes-js",
"VcsCommitNumber": "91d693f",
"VcsCommitUrl": null,
"WorkItems": [],
"Commits": []
}
],
"WorkItems": [
{
"Id": "RQJ-2",
"LinkUrl": "https://octopussamples.atlassian.net/browse/RQJ-2",
"Source": "Jira",
"Description": "Jeremy Miller, comment for issue"
}
],
"Commits": [
{
"Id": "91d693fcaa4a8a6de5b18e814ede2a7c40b2a8b5",
"LinkUrl": "http://bitbucket.org/octopussamples/randomquotes-js/commits/91d693fcaa4a8a6de5b18e814ede2a7c40b2a8b5",
"Comment": "RQJ-2 - Really want to get workitems in samples"
}
]
}
]
The easiest way to see all of the variables and information available to you is to enable variable logging. Here is a link explaining it: https://octopus.com/docs/support/how-to-turn-on-variable-logging-and-export-the-task-log. It’s not recommended to keep this enabled forever, it’s best just to use it to figure out issues/processes, as it can slow down your deployment.
Once you’ve done this you will be able to see all of the information laid out for you in your verbose/raw log.
Please let me know if this helps and you’re able to get your script working or if you need more assistance.
Thanks,
Jeremy