I can easily determine the required values from several fields. If I have all the values, then I can also define the new priority of the issue. Unfortunately I don't manage to write them back. Appreciating any clues.
def Leben = getCustomFieldValue("Leben")
def Notfall = getCustomFieldValue("Notfall")
def GS = getCustomFieldValue("GS")
def DS = getCustomFieldValue("DS")
def SK = getCustomFieldValue("SK")
int result = 0
int Prio = 10505
if (Leben.value == "Ja" || Leben.value == "Offen") {
result = 4
}
else {
if (Notfall.value == "Ja") {result = 2}
if (GS.value == "Ja" || GS.value == "Offen") {result = result +1}
if (DS.value == "Ja" || DS.value == "Ohne") {result = result +1}
}
// Priorität MEDIUM
if (SK.value == "Sehr hoch" && (result == 1 || result == 0)) {Prio = 10400}
if (( SK.value == "Mittel" || SK.value == "Hoch") && result == 1) {Prio = 10400}
if ((SK.value == "Sehr niedrig" || SK.value == "Mittel") && result == 2) {Prio = 10400}
if (SK.value == "Sehr niedrig" && result == 3) {Prio = 10400}
// Priorität High
if ((SK.value == "Sehr hoch" || SK.value == "Hoch") && result == 2) {Prio = 10504}
if ((SK.value == "Mittel" || SK.value == "Hoch") && result == 3) {Prio = 10504}
if ((SK.value == "Sehr niedrig" || SK.value == "Mittel") && result == 4) {Prio = 10504}
// Priorität Highest
if (SK.value == "Sehr hoch" && result == 3) {Prio = 10701}
if ((SK.value == "Sehr hoch" || SK.value == "Hoch") && result == 4) {Prio = 10701}
// Here I'm not able to write back the Priority ID.
return result
https://library.adaptavist.com/entity/update-the-priority-of-an-issue-in-jira has code for updating a priority!
Thanks for the hint. What is my fault. No errors, no result?
import com.atlassian.jira.component.ComponentAccessor
def issueService = ComponentAccessor.issueService
def Leben = getCustomFieldValue("Leben")
def Notfall = getCustomFieldValue("Notfall")
def GS = getCustomFieldValue("GS")
def DS = getCustomFieldValue("DS")
def SK = getCustomFieldValue("SK")
int result = 0
int Prio = 10505
if (Leben.value == "Ja" || Leben.value == "Offen") {
result = 4
}
else {
if (Notfall.value == "Ja") {result = 2}
if (GS.value == "Ja" || GS.value == "Offen") {result = result +1}
if (DS.value == "Ja" || DS.value == "Ohne") {result = result +1}
}
// Priorität MEDIUM
if (SK.value == "Sehr hoch" && (result == 1 || result == 0)) {Prio = 10400}
if (( SK.value == "Mittel" || SK.value == "Hoch") && result == 1) {Prio = 10400}
if ((SK.value == "Sehr niedrig" || SK.value == "Mittel") && result == 2) {Prio = 10400}
if (SK.value == "Sehr niedrig" && result == 3) {Prio = 10400}
// Priorität High
if ((SK.value == "Sehr hoch" || SK.value == "Hoch") && result == 2) {Prio = 10504}
if ((SK.value == "Mittel" || SK.value == "Hoch") && result == 3) {Prio = 10504}
if ((SK.value == "Sehr niedrig" || SK.value == "Mittel") && result == 4) {Prio = 10504}
// Priorität Highest
if (SK.value == "Sehr hoch" && result == 3) {Prio = 10701}
if ((SK.value == "Sehr hoch" || SK.value == "Hoch") && result == 4) {Prio = 10701}
def issueInputParams = issueService.newIssueInputParameters()
issueInputParams.with {priorityId = Prio}
return result
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.