Sync Affected Version

Originally asked by Berry Kersten on 14 January 2020 (original question)


Hi,

I’m trying to sync the field affectedVersions, but I encounter some problems:
(1) sync to the remote field affectedVersions does not work, because there are different affectedVersions on the source/remote side

(2) sync to a remote label (with incoming sync issue.labels = replica.affectedVersions) returns an error (One or more labels in ‘hubIssue.getLabels’ is not of type IHubLabel but `com.exalate.basic.domain.hubobject.v1.BasicHubVersion)

I don’t want to use a new custom field for that. What is the best practice for this? Maybe sync to a comment with a default text ‘Affected version’ and then the synced field affectedVersions ?

Thanks.Source: Jira Server/Datacenter (old community)


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

Answer by Berry Kersten on 22 January 2020

Hi Peter HochstrasserThe issue is resolved! I’ve used the info in another Community Question (How to sync Fix version to custom text field (old community))


Comments:

Peter Hochstrasser commented on 22 January 2020

Great - and have fun with Exalate!

Answer by Peter Hochstrasser on 16 January 2020

Hi Berry Kersten

You cannot add versions that are not in the list of versions - that’s a JIRA restriction you can’t circumvent.

What you can do instead is

  • create a text field
  • convert the affected versions to text and sync that value.

Hope this helps.

Yours truly

Peter


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.