Hi,
I am getting the below ERROR, in my
Fast-track transition an issue post function - but same is working in my older version JIRA 6.7.x before JIRA upgrade was done. Now I am using the below s/w versions.
2017-03-23 13:10:28,519 ERROR [utils.WorkflowUtils]: Errors: {} Error Messages: [Error occurred while creating issue. This could be due to a plugin being incompatible with this version of JIRA. For more details please consult the logs, and see: http://confluence.atlassian.com/x/3McB java.lang.String cannot be cast to java.util.Collection] Start of logs truncated as they exceeded 300 lines.
Adaptavist ScriptRunner for JIRA is 4.3.16 and JIRA s/w version is 7.2.7
Condition::
def cfds = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Defect Source'};
String cfdsv = issue.getCustomFieldValue(cfds);
cfValues['Defect Source']?.value == 'ITG' || cfValues['Defect Source']?.value == 'ITG-Traffic' || cfValues['Defect Source']?.value == 'MTG_TRAFFIC' || cfValues['Defect Source']?.value == 'ITG-Automation' || cfValues['Defect Source']?.value == 'Design Server' || cfValues['Defect Source']?.value == 'MTG' || cfValues['Defect Source']?.value == 'FOA' || cfValues['Defect Source']?.value == 'Requirements' || cfValues['Defect Source']?.value == 'System Engineering'
Action: Assign to Engineering (231)
2017-03-23 13:10:28,519 ERROR [utils.WorkflowUtils]: Errors: {} Error Messages: [Error occurred while creating issue. This could be due to a plugin being incompatible with this version of JIRA. For more details please consult the logs, and see: http://confluence.atlassian.com/x/3McB java.lang.String cannot be cast to java.util.Collection] Start of logs truncated as they exceeded 300 lines.
Due to which I am unable to create cloned issues and link it using another post function in my workflow.
Same works in my older version JIRA s/w. Please suggest what is causing this issue in new JIRA version used.
Community moderators have prevented the ability to post new answers.
I suspect it might be the second line of your condition, but it looks more like an error in the script being run, which you've not given us. Custom field storage is a little different and scripts need to be adapted.
Nic,
In My Fast Track Transition condition, the below one line is good enough as I am not using cfds
and cfdsv values any more.
cfValues['Defect Source']?.value == 'ITG' || cfValues['Defect Source']?.value == 'ITG-Traffic' || cfValues['Defect Source']?.value == 'MTG_TRAFFIC' || cfValues['Defect Source']?.value == 'ITG-Automation' || cfValues['Defect Source']?.value == 'Design Server' || cfValues['Defect Source']?.value == 'MTG' || cfValues['Defect Source']?.value == 'FOA' || cfValues['Defect Source']?.value == 'Requirements' || cfValues['Defect Source']?.value == 'System Engineering'
But same line works fine in my older JIRA version i,e 6.7.16 with out any ERROR.
But now i am using 7.2.7 JIRA s/w version and started failing using the ERROR posted above...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Even I treid to change the condition as below::
cfValues['Defect Source']?.value in ["ITG", "ITG-Automation", "ITG-Traffic", "Design Server", "MTG_TRAFFIC"]
Still same error persists..
2017-03-23 13:10:28,519 ERROR [utils.WorkflowUtils]: Errors: {} Error Messages: [Error occurred while creating issue. This could be due to a plugin being incompatible with this version of JIRA. For more details please consult the logs, and see: http://confluence.atlassian.com/x/3McB java.lang.String cannot be cast to java.util.Collection] Start of logs truncated as they exceeded 300 lines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For more details on "Defect Source" custom field:
Defect Source is of Select List (single choice) date type.
def componentCF1 = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Defect Source")
def selectedComponents1 = issue.getCustomFieldValue(componentCF1)
newIssue.setCustomFieldValue(componentCF1, selectedComponents1)
is the above steps are right way to copy from parent issue to Cloned issue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What is "defect source" - select or date? It can't be both. Although I think that is the problem, as select fields are not strings.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
"defect source" is of Select List (single choice) date type with value such as ITG, SQ, MTR configured.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please, select list OR date? Which is it?
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.
Ok, sorry, I should have been able to see that from the last post, but you kept repeating "date"
A select list does not return a string, that's why you're getting a "cast" error. You need to convert the array it returns to a string before you can compare it with another string.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you mean cfValues['Defect Source']?.value will return a String value?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
And one more thing is, the above shared condition script is implemented based on the below options present in the Jira/Script runner post function example:
Fast-track transition an issue ->
Has select list value equal to
cfValues['My Select List']?.value == 'My value'
But it was working in my previous JIRA version i,e 6.7.16
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>Do you mean cfValues['Defect Source']?.value will return a String value?
No. It won't. That's the point.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nic,
I tried to re-write my Fast Track Transition condition to get the String value from my select list custom field and try to re-execute the one JIRA issue state transition. But same Error has been observed.
import com.atlassian.jira.component.ComponentAccessor
def componentCF1 = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Defect Source")
String selectedComponents1 = issue.getCustomFieldValue(componentCF1)
log.info(selectedComponents1)
String optionToDS = ComponentAccessor.getOptionsManager().getOptions(componentCF1.getRelevantConfig(issue)).find {option -> option.value == selectedComponents1}
log.info(optionToDS)
//if(optionToDS == "ITG")
if(selectedComponents1 == "ITG")
return true
else
return false
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Even I tried::
if(optionToDS == "ITG")
return true
else return false
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Again, options are not strings, and a select list does not return a string, that's why you're getting a "cast" error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nic,
Based on your last comment, i,e "You need to convert the array it returns to a string before you can compare it with another string."
Was trying to convert "option" value (i,e for "Defect Source" - Single Select list data type) to array it returns to a string ... using my below script. But selectedvalues variable is updated as null value. But no errors in the script found after execution.
I am not getting, what is wrong in this script.....
def cascade6 = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Defect Source") def cfVal6 = issue.getCustomFieldValue(cascade6) //List<Option> selectedvalues = (List<Option>) issue.getCustomFieldValue(cascade6); //log.info(selectedvalues) List<String> selectedIDs = new ArrayList<String>(); List<Option> selectedvalues = (List<Option>) ComponentAccessor.getOptionsManager().getOptions(cascade6.getRelevantConfig(issue)).find {option -> option.value == cfVal6} log.info(selectedvalues) if (selectedvalues != null) { for (Option option : selectedvalues) { selectedIDs.add(option.getOptionId().toString()); log.info(option.getOptionId().toString()) log.info(option.getOptionId()) }// for end }
As Defect Source is a single select list, max one option value will be chosen during my workflow transition based on the option, Fast Track Transition should succeed.
Even though it's array, only option value should be copied as per the Defect Source data types used.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> max one option value will be chose
Yes, but it is still an option value in an array. That's what cfVa16 is returning back to you. You can't cast it to a string, you need to get the single option out of the array and get the name of the option out of that (or compare it with the options available without going through strings)
Looking at the line:
List<Option>
selectedvalues = (List<Option>)
ComponentAccessor.getOptionsManager().getOptions(cascade6.getRelevantConfig(issue)).find
{option -> option.value == cfVal6}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nic,
After changing to option -> option == cfVa16, I am getting the below ERROR now.
2017-03-28 17:08:19,251 ERROR [utils.ConditionUtils]: ************************************************************************************* 2017-03-28 17:08:19,251 ERROR [utils.ConditionUtils]: Condition failed on issue: INT-7546, built-in script:com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.FasttrackTransition org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'ITG' with class 'com.atlassian.jira.issue.customfields.option.LazyLoadedOption' to class 'java.util.List' at Script1979.run(Script1979.groovy:29)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you re-read the stuff I've said several times about arrays?
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.