Sync fixversions from Instance A to B in the visual mode

Originally asked by SDGTLS on 10 September 2021 (original question)


There is an example in the documentation but this is not working: https://docs.idalko.com/exalate/display/ED/Script+rules+examples

// assign fix versions from JIRA A to JIRA B
your_instance_shortname.issue.fixVersions = remote_instance_shortname.
  .fixVersions
  // ensure that all the fixVersions are available on B
  .collect { v -> nodeHelper.createVersion(issue, v.name, v.description) }
// assign affected versions from JIRA A to JIRA B
your_instance_shortname.issue.affectedVersions = remote_instance_shortname
  .affectedVersions
  .collect { v -> nodeHelper.createVersion(issue, v.name, v.description) }

We did create every fixversion on every instance - just to be sure. Both sides are the same


Comments:

Francis Martens (Exalate) commented on 10 September 2021

What is not working - can you provide an example

SDGTLS commented on 10 September 2021

there comes no error or something like that. Only no sync of fixversion. So nothing is happening. Donā€™t know why (old community) and yes we did change the ā€œyour_instance_shortname.ā€ and ā€œremote_instance_shortname.ā€ also in both directions

Francis Martens (Exalate) commented on 10 September 2021

can you inspect why it is not working?

You can add

debug.error("Version = ${someVersionVariable}")

Where you replace ā€˜someVersionVariableā€™ with something that needs to be inspected
This will raise an error, allowing you to see what the information is

SDGTLS commented on 10 September 2021

not working, this is the errormessage:

Errormessage.txt (old community)

Francis Martens (Exalate) commented on 10 September 2021

You will have to use a proper construct.

Script117.groovy: 3: unexpected token: . @ line 3, column 3..fixVersions

Means that the line needs to be reviewed.

SDGTLS commented on 10 September 2021

and this is not a proper construct?

// assign fix versions from JIRA A to JIRA B
BELLVIS.issue.fixVersions = DGTLS.
  .fixVersions
  // ensure that all the fixVersions are available on B
  .collect { v -> nodeHelper.createVersion(issue, v.name, v.description) }
// assign affected versions from JIRA A to JIRA B
BELLVIS.issue.affectedVersions = DGTLS
  .affectedVersions
  .collect { v -> nodeHelper.createVersion(issue, v.name, v.description) }

Is it casesensitiv?

Francis Martens (Exalate) commented on 10 September 2021

Something is wrong with

BELLVIS.issue.fixVersions = DGTLS.
  .fixVersions
Serhiy Onyshchenko commented on 11 September 2021

Hello, Francis Martens (Exalate) , SDGTLS
The problem is it should be

BELLVIS.issue.fixVersions = DGTLS.issue
  .fixVersions
  // ensure that all the fixVersions are available on B
  .collect { v -> nodeHelper.createVersion(issue, v.name, v.description) }

instead.
Or better yet, check the response here for the full script and a video: Sync the epic and epic link in visual mode (old community)