Originally asked by Sebastian Ignacio Kuhnel on 28 November 2023 (original question)
We are implementing a solution for a client where we need to synchronize subtasks between a Cloud instance and an OnPremise instance.
We have followed the following documentation: https://docs.exalate.com/docs/how-to-sync-tasks-and-subtasks-in-jira-on-premise and implemented the code that appears there in both outgoing and incoming sections.
Our code in incoming is the following:
if(firstSync && replica.parentId){
issue.projectKey = "IDI"
issue.typeName = "Subtarea"
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. localParent: " + localParent )
}
}
Everytime we run it the following error message shows up:
Subtask cannot be created: parent issue with remote id 61041 was not found. Please make sure the parent issue is synchronized before resolving this error. localParent: null
This method should return “null” only if it cannot be found, but the problem is that the parentId is already correctly synchronized between both instances.
If I search in the “Entity Sync status” panel, the issue I am trying to obtain comes up correctly. Also, looking at the API call it makes in the Network tab when Inspecting the page. I also see that all the information is correct.
Entity Sync Status - REST API call
{
"statuses": [
{
"status": "SYNCHRONIZED",
"connectionName": "CENSORED_to_CENSORED",
"twinTraceId": 1180,
"remoteUrl": "https://CENSORED.atlassian.net/browse/PDT-15652",
"remoteSummary": "CENSORED",
"remoteIssueUrn": "PDT-15652",
"localUrl": "https://CENSORED.com/browse/IDI-1158",
"localIssueUrn": "IDI-1158"
}
],
"doesEntityExist": true,
"belongsToProject": true
}
We have been working on this issue for a whole day, and reviewing the documentation, we cannot even find method
getLocalIssueFromRemoteId(). We have simply been able to find getLocalIssueKeyFromRemoteId(), when trying it, it gives us a “No signature of method: com.exalate.node…” error.
We have tried all the syncHelper methods in the documentation, but we have not been able to obtain any information from the parent issue.
We are not sure how to solve this issue. If anyone has faced the same problem as us, we would appreciate the help.