I have a custom field (list) A, with values as follows:
1 - Unlikely, 2 - Low likelihood, 3 - Likely, 4 - Very likely, 5 - Near certainty
I have another custom field (list) B, with values as follows:
1 - Minimal, 2 - Minor, 3 - Moderate, 4 - Major, 5 - Unacceptable
Whenever user changes the field value, I need to do the below:
How do I achieve this?
Note:
Hello @Jemima James
This makes an interesting scenario, due to the limitation in the data centre versions, where variables cannot be defined. Having said that, we can still achieve this with the following steps:
For example:
Considering the below matrix, we can set the rule.
If Field A = "1 - Unlikely" and Field B in (1 - Minimal, 2 - Minor, 3 - Moderate, 4 - Major, 5 - Unacceptable) --> THEN --> Set Field C as X
Kindly accept the answer if this helps. please feel free to reach out in case of any further queries.
Regards,
--GG
Using scriptrunner you can use something like:
class Example { static void main(String[] args) { def singleSelectField1 = ComponentAccessor.customFieldManager.getCustomFieldObject(10402) // id of the CF substitute with your first field
def singleSelectFieldValue1 = issue.getCustomFieldValue(singleSelectField) def numpart1 = singleSelectFieldValue1.substring(0,0)).toInteger(); def singleSelectField2 = ComponentAccessor.customFieldManager.getCustomFieldObject(10402) // id of the CF substitute with your second field
def singleSelectFieldValue2 = issue.getCustomFieldValue(singleSelectField) numpart1 = singleSelectFieldValue1.substring(0,0));
def numpart2 = singleSelectFieldValue1.substring(0,0)).toInteger();
def product = numpart1 * numpart2
} }
to extract the number part of the list fields and multiply the results. After that it is simply maken an if-then constuction to determen the letter and after that write this to the target field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.