Hi guys, I have read over many examples as well as the documentation but at the end of the day I'm not a programmer so am out of luck.
I have 3 custom fields:
- Likelihood, a single choice select list with text A, B, C
- Severity, a single choice select list with text D, E, F
- Rating, a scriptrunner calculated field with text
I just want to set the Rating based on what has been chosen for Likelihood and Severity, there are really just 9 combinations:
- If Likelihood = A and severity = D set the Rating to 1
- If Likelihood = A and severity = E set the Rating to 2
- If Likelihood = A and severity = F set the Rating to 3
- If Likelihood = B and severity = D set the Rating to 4
- If Likelihood = B and severity = E set the Rating to 5
- If Likelihood = B and severity = F set the Rating to 6
- If Likelihood = C and severity = D set the Rating to 7
- If Likelihood = C and severity = E set the Rating to 8
- If Likelihood = C and severity = F set the Rating to 9
I tried loading up something like this but the preview just ends up null:
---
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def likelihood = customFieldManager.getCustomFieldObjectByName("Likelihood")
def severity = customFieldManager.getCustomFieldObjectByName("Severity")
def rating = customFieldManager.getCustomFieldObjectByName("Rating")
def impactValue = issue.getCustomFieldValue(severity)
def probabilityValue = issue.getCustomFieldValue(likelihood)
def ratingValue = issue.getCustomFieldValue(rating)
if ((impactValue="A") && (probabilityValue="D")){
rating="1"
}
Thanks for your help