...
This example retrieves attribute values of assets based on a custom field value in Jira. It assumes you've already obtained the custom field value using a Script RunnerScriptRunner.
Scenario
Three assets are selected in a custom field, and the custom field's value contains leading and trailing commas (",187,189,208,").
For each asset ID, the script calls the Jira search API to get the asset object and retrieves the specified attribute value.
...
Update the following parameters according to your Jira instance:
attributeName
: The name of the attribute to search for (e.g.for example, "Serial Number").AUTH_HASH
: Base64 encoded authorization hash for a user with "Browse Assets" permission for all asset types. You can generate the hash usingecho -n "username:password" | base64
. Replace "username" and "password" with your Jira credentials.assetCustomFieldId
: The ID of the custom field containing the asset selections. You can find the ID by right-clicking on the custom field in the issue edit screen and selecting "Copy ID."issueKey
: The issue key for the issue where the script is being executed.
...