issue.typeName \= "Sub\-task" //Make sure to use the right subtask type here.
def localParent \= nodeHelper.getLocalIssueFromRemoteId(replica.parentId.toLong())
if(localParent){
issue.parentId \= [localParent.id](http://localParent.id)
} else {
throw new com.exalate.api.exception.IssueTrackerException("Subtask cannot be created: parent issue with remote id " \+ replica.parentId \+ " was not found. Please make sure the parent issue is synchronized before resolving this error" )
}
The problem is that Jira initially create the subtask without parent Id and Exalate tries to sync it like that. You can fix that by adding this on top of your outgoing script:
is that the incoming sync is about a story, stories are not sub-tasks.
Can you check it out?
Ariel Einfeld commented on 14 December 2020
That line is just a checker to check if it gets an issueType during the migration, if not it will set it as a Bug.
but that is not the issue here as i have another function right after that where i reset the issue type.
if(firstSync && replica.parentId){
issue.typeName \= "Sub\-task" //Make sure to use the right subtask type here.
def localParent \= nodeHelper.getLocalIssueFromRemoteId(replica.parentId.toLong())
if(localParent){
issue.parentId \= [localParent.id](http://localparent.id/)
} else {
throw new com.exalate.api.exception.IssueTrackerException("Subtask cannot be created: parent issue with remote id " \+ replica.parentId \+ " was not found. Please make sure the parent issue is synchronized before resolving this error" )
}
}
Ariel Einfeld commented on 14 December 2020
and its not working, its creating a story.
Francis Martens (Exalate) commented on 14 December 2020
If the incoming sync is a story, parentId is not set and the section
...issue.typeName = "Sub-task" //Make sure to use the right subtask type here.
....
Is totally ignored.
Can you check the issue type of the incoming sync by throwing an exception
throw new Exception("Incoming issue type = ${replica.typeName}")
Put this on line 1 of your incoming sync on the target side.
Whenever a new message comes in, it will raise an error with the detail you are looking for.
Part of the details is the ‘remote replica’. Have a look into that also - and check if the parentid is set (or not)