Answer by Peter Hochstrasser on 14 January 2020
Hi Berry
This is not really out of the box, but exalate offers a groovy script called Versions.groovy which will allow you not only to sync the value on the issue, but also adds it to the list of versions if required. Search for it - it does the trick.
Comments:
Berry Kersten commented on 14 January 2020
Hi Peter HochstrasserThanks for the quick reply. I will try that!
Next to that, is there also an alternative solution for this? For example, sync the source affectedVersions to a comment?
Berry Kersten commented on 16 January 2020
Hi Peter Hochstrasser, I talked to the stakeholders about this solution, but they did not want to add extra values for Version in the remote project.
So therefore I tried to sync to a custom field ‘Reported Affected Version’, but I got an error:
Exception evaluating property ‘value’ for java.util.LinkedHashSet, Reason: groovy.lang.MissingPropertyException: No such property: value for class: com.exalate.basic.domain.hubobject.v1.BasicHubVersion
This is the incoming sync config:
//sync for project UNI
issue.customFields."Reported Affected Version".value = replica.affectedVersions.value?.value
//sync for project UA
issue.customFields."Reported Affected Version".value = replica.customFields."UA Version Number".value?.value
//sync for project DLM
issue.customFields."Reported Affected Version".value = replica.customFields."DLM version".value?.value
Any idea how I can fix this? Thanks!
Peter Hochstrasser commented on 16 January 2020
Hi Berry Kersten
I expect that you’d need some kind of type conversion between the affectedVersions data type and the string of the custom fields.
Keep in mind that affectedVersions is potentially a list, not a single value.
Yours truly
Peter
Berry Kersten commented on 20 January 2020
Hi Peter Hochstrasserthanks for the additional info. I’m not sure how to convert the affected versions to text and sync that value.
Therefore, as an alternative approach, I’ve used the following documentation: https://docs.idalko.com/exalate/display/ED/Sync+between+Cascading+Select+and+Text+custom+fields which resulted in the following incoming sync:
issue.customFields."Reported Affected Version" = replica.affectedVersions?.value?.parent?.value +
", " + replica.affectedVersions?.value?.child?.value
However, I still get an error:
Script error for issue UNI-14298. Details: Exception evaluating property ‘value’ for java.util.LinkedHashSet, Reason: groovy.lang.MissingPropertyException: No such property: value for class: com.exalate.basic.domain.hubobject.v1.BasicHubVersion Possible solutions: name. Error line: Script45.groovy:19
I assumed this method should work in theory as well as the system field affectedVersions is of type Cascading Select, right?
In case this method does not work, does Exalate provide some kind of “conversion script”?
Peter Hochstrasser commented on 20 January 2020
Hi Berry Kersten
There are lots of examples in the community. Also, if you ask iDalko, they are most helpful with their support.
Just searching for convert in the community yielded the following page:
https://docs.idalko.com/exalate/display/ED/How+to+convert+remote+status+changes+to+local+comments
or this here:
https://docs.idalko.com/exalate/display/ED/Script+rules+examples
The code shown under heading Versions on that page shows you the attributes of (affected/fix)Versions that you might want to retrieve as strings. value is not one of them.
As you see, I try to get you fishing instead of putting the fish in your hand.
Yours truly
Peter