# Issues with the Subtask Sync

**URL:** <https://community.exalate.com/t/issues-with-the-subtask-sync/6776>\
**Category:** General Questions\
**Created:** [September 23, 2025, 10:50am UTC](https://community.exalate.com/t/issues-with-the-subtask-sync/6776 "2025-09-23T10:50:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jillani\_Fazal](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/jillani_fazal/32/355_2.png) [@Jillani\_Fazal](https://community.exalate.com/u/Jillani_Fazal)\
**Post date:** [September 23, 2025, 10:50am UTC](https://community.exalate.com/t/issues-with-the-subtask-sync/6776/1 "2025-09-23T10:50:46Z")

</div>

Hi team,

Trying to sync the subtask from Jira on Prem to Jira Cloud. The subtask do gets synced if exalated manually or via the trigger and here is the script:

JoP outgoing:

replica.parentId = issue.parentId

JC Incoming:

`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" ) `  
`} `

`}`

However, if try the following snippet in order sync the subtasks automatically, the subtasks do not get synced:

Added the following in the JoP outgoing:

`// Automatically sync all subtasks when syncing parent task httpClient.get("/rest/api/3/issue/"+issueKey.id).fields.subtasks?.collect{ def subTaskKey = new com.exalate.basic.domain.BasicIssueKey(it.id, it.key) syncHelper.exalate(subTaskKey) }`

All the snippets are being taken from this article:

> **[How to Sync Tasks and Subtasks in Jira Cloud](https://docs.exalate.com/docs/how-to-sync-tasks-and-subtasks-in-jira-cloud)**
>
> This article explains how to Sync Tasks and Subtasks in Jira Cloud.

Note that the same snippets are added when checked for Jira On Prem: [How to Sync Tasks and Subtasks in Jira On-premise](https://docs.exalate.com/docs/how-to-sync-tasks-and-subtasks-in-jira-on-premise)

Please check and advise on how to address this - Thank you!

---

<div class="post-metadata">

**Author:** ![Aida](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/aida/32/580_2.png) [@Aida](https://community.exalate.com/u/Aida)\
**Post date:** [September 23, 2025, 10:51am UTC](https://community.exalate.com/t/issues-with-the-subtask-sync/6776/2 "2025-09-23T10:51:07Z")

</div>

Great question! You’re on the right track with syncing subtasks between Jira On-Prem and Jira Cloud, and you’ve referenced the correct documentation. Let’s break down what’s happening and how to get the automatic subtask sync working smoothly.

**What’s working:**

- Manual or trigger-based subtask sync works fine.
- Your outgoing and incoming sync scripts for parent/child relationships are set up as per the docs.

**What’s not working:**

- When you try to automatically sync all subtasks by adding the `syncHelper.exalate(subTaskKey)` logic in the outgoing script, the subtasks don’t sync as expected.

**Why this happens:**  
The main reason is that the `syncHelper.exalate()` function only works if the Exalate app has access to the subtasks you’re trying to sync. In Jira On-Prem, the REST API endpoint you’re using (`/rest/api/3/issue/`) is for Jira Cloud, not Jira Server/Data Center. For Jira On-Prem, you should use the appropriate REST API endpoint and field structure.

**How to fix it:**

1. **Use the correct REST API endpoint for Jira On-Prem:**  
For Jira Server/Data Center, the endpoint should be `/rest/api/2/issue/` instead of `/rest/api/3/issue/`.

2. **Adjust the script for Jira On-Prem:**  
Here’s how you can modify your outgoing sync script for Jira On-Prem:

3. **Make sure permissions are correct:**  
The Exalate app user must have permission to view the parent issue and its subtasks.

4. **Parent must be synced first:**  
Subtasks can only be created if their parent exists on the destination. Your incoming script already checks for this, which is perfect.

**References:**

- [How to Sync Tasks and Subtasks in Jira On-Premise](https://docs.exalate.com/docs/how-to-sync-tasks-and-subtasks-in-jira-on-premise)
- [How to Sync Tasks and Subtasks in Jira Cloud](https://docs.exalate.com/docs/how-to-sync-tasks-and-subtasks-in-jira-cloud)

**Summary:**  
Update your outgoing script to use the correct API endpoint for Jira On-Prem, and ensure the Exalate user has the right permissions. This should get your automatic subtask sync working as expected.

Hope this clears things up and gets your sync running smoothly!

---

<div class="post-metadata">

**Author:** ![Jillani\_Fazal](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/jillani_fazal/32/355_2.png) [@Jillani\_Fazal](https://community.exalate.com/u/Jillani_Fazal)\
**Post date:** [September 23, 2025, 10:51am UTC](https://community.exalate.com/t/issues-with-the-subtask-sync/6776/4 "2025-09-23T10:51:37Z")

</div>

Hi @Sonal_Otwani

Can we check this further? Thank you!
