I would like to write a few new post functions. These post functions will include 3-4 custom fields, and based on the selections within these fields (select type), I would like to transition to the necessary status. Could you assist with the scripting for this?
"The 'Transition issue based on the following parameters' post function works. However, I believe my JQL query is too large (3-4 minimum condition (customField_XXX = "Test", and etc), so it may be unable to handle it effectively. I think the 'Fast-track transition an issue' post function could resolve this immediately. I just need assistance with writing the script in a way that can handle it. Thank you!"
Hi @Nadir Jabbarli ,
As you have mentioned, this is something you can definitely do with ScriptRunner's fast track post function feature.
For the script, its quite simple to check values, you just need to handle them correctly. Here is an example script that give you examples on how you can handle the following:
def priorityValue = issue.getPriority().id
def customTextFieldValue = issue.getCustomFieldValue('Custom Text Field')
def customSingleSelectValue = issue.getCustomFieldValue('Custom Single Select')
def customNumberFieldValue = issue.getCustomFieldValue('Custom Number Field')
def customMultiSelectValue = issue.getCustomFieldValue('Custom Multi Select') as Map
boolean priorityValid = (priorityValue == "3") // ID for medium prio
boolean textValueValid = (customTextFieldValue == "Test")
boolean singleSelectValueValid = customSingleSelectValue.any { it.value == "1"}
boolean numberValueValid = (customNumberFieldValue > 10)
def requiredValues = ['2', '3']
boolean multiSelectValueValid = requiredValues.every { requiredValue ->
customMultiSelectValue.any { it.value == requiredValue }
}
if(priorityValid && textValueValid && singleSelectValueValid && numberValueValid && multiSelectValueValid){
return true
} else {
return false
}
Let me know if this helps!
Kind regards,
Bobby
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.