Error syncing Sub-task

Originally asked by Paolo Bolla on 24 July 2021 (original question)


In visual mode, from cloud to cloud instance, when i try to sync subtask i have this error:

`Issue type` with name `Sub-task` is not found. Please select a valid `Issue type`.Check the documentation for more details.

The 2 project have same workflow, same issue types and for other issues there’s no problem. No script used.


Answer by Ariel Aguilar on 26 July 2021

Hi Paolo,

In order to sync Sub-tasks, you need to make sure you to sync the parent task first. So if you sync subtasks before the parent task, you will get an error. Then, the way you have the mapping is fine, the problem here is that you are trying to sync a sub-task and the parent ID information is missing, therefore it throws this error as an “Issue type” error. However, this should not be a problem:

  1. Check the following documentation on how to add script: https://docs.idalko.com/exalate/x/ogXHAw
  2. To add the script, clear the default text from script box and only add the script as follows:
if (executionInstanceName == "cinetix-group") {
  if (firstSync && replica.parentId) {
      def localParent = syncHelper.getLocalIssueKeyFromRemoteId(replica.parentId.toLong())
    if(localParent){
        issue.parentId = localParent.id
    }
}
}

//The connection name in this example is heidix_to_cinetix-group.
3. Make sure to save and publish changes. Make sure to sync the parent task first and then try sub-tasks.
Let me know if this works for you.
Kind regards,
Ariel


Comments:

Paolo Bolla commented on 26 July 2021

Works! Great!

All the Sub-tasks was created correctly.

Thanks Ariel.

Paolo