Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save reikjarloekl/567a64667ddaa90633d8084924d79358 to your computer and use it in GitHub Desktop.
Save reikjarloekl/567a64667ddaa90633d8084924d79358 to your computer and use it in GitHub Desktop.
Jira Cloud ScriptRunner - Scripted field filled with asset category taken from linked asset issue
def assetKey = issue.fields?.issuelinks?.find{it.type.name == "Affected asset"}?.outwardIssue?.key
if (assetKey == null) return "No asset linked"
def assetIssue = Unirest.get("/rest/api/2/issue/" + assetKey).asJson().getBody().object
return Optional.ofNullable(assetIssue.fields.customfield_10267?.find{true}?.value).orElse("No category set")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment