2 answers
- 432
Hi!
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:
if(issue.typeName == "Sub-task" && issue.parentId == null) return replica.parentId = issue.parentId
That will make sure that Exalate will only sync when the parentId is set by Jira
Add your comment... - 10-1
What is the problem you encounter?
- Ariel Einfeld
when i create a sub-task, it syncs it to the other instance as a Story level issuetype, not as a sub-task under the parent.
- Francis Martens (Exalate)
Can you investigate why it is becoming a story
Looking atissue.typeName = nodeHelper.getIssueType(replica.typeName)?.name ?: "Bug"
is that the incoming sync is about a story, stories are not sub-tasks.
Can you check it out? - Ariel Einfeld
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
} 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
and its not working, its creating a story.
- Francis Martens (Exalate)
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 exceptionthrow 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)
Add your comment...
Hello,
i am using this code from your site and it doesnt work.
it is creating the Sub-Task as a regular Task and not as a sub-task.
OutGoing Sync:
replica.parentId = issue.parentId
Incominfg Sync:
if(firstSync){
issue.projectKey = "RTFACT"
// Set type name from source issue, if not found set a default
issue.typeName = nodeHelper.getIssueType(replica.typeName)?.name ?: "Bug"
}
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
} 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" )
}
}