# Check if Epic is already synced in the local system

**URL:** https://community.exalate.com/t/check-if-epic-is-already-synced-in-the-local-system/4260
**Category:** General Questions
**Tags:** onpremise-jira, migrated\_question
**Created:** [November 4, 2024, 6:42am UTC](https://community.exalate.com/t/check-if-epic-is-already-synced-in-the-local-system/4260 "2024-11-04T06:42:45Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)
#### Post date: [November 4, 2024, 6:42am UTC](https://community.exalate.com/t/check-if-epic-is-already-synced-in-the-local-system/4260/1 "2024-11-04T06:42:45Z")

</div>

_Originally asked by Ziad Qadora on 19 June 2020 [(original question)](https://oldcommunity.exalate.com/questions/11340210)_

* * *

Hello,

When trying to sync a story before syncing the Epic, and I get an error. I’m trying to find out how to check if the parent Epic has been synced, and throw an error if it was not. Something like this which was done for Sub-Tasks

if (replica.parentId) {  
def localParent =nodeHelper.getLocalIssueFromRemoteId(replica.parentId.toLong())  
if(localParent){  
issue.parentId = localParent.id  
} else {  
throw new com.exalate.api.exception.IssueTrackerException(issueType + " 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" )  
}  
}Source: [Jira Server/Datacenter](https://oldcommunity.exalate.com/pages/viewpage.action?pageId=3703137)_(old community)_

* * *

---

<div class="post-metadata">

### Author: ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)
#### Post date: [November 4, 2024, 6:42am UTC](https://community.exalate.com/t/check-if-epic-is-already-synced-in-the-local-system/4260/2 "2024-11-04T06:42:46Z")

</div>

_Answer by Ziad Qadora on 19 June 2020_

Hi Francis,

I did the follow the instructions in the epic sync

//Outgoing

//Epic Link  
Epic.sendEpicFirst()  
// Issue link sync  
IssueLinks.send()  
//Task Sync  
SubTask.send()

//Incoming

// Move this to the end of the incoming sync script  
SubTask.receive()  
Epic.receive()

I do understand that we must sync the Epic first then the Story, but I want to print more meaningful message like the one for the sub-task

here is what I just added, but still do not see the error message

if (replica.epicId) {  
def localEpic = nodeHelper.getLocalIssueFromRemoteId(replica.epicId.toLong())  
if(localParent){  
issue.epicId = [localEpic.id](http://localEpic.id)  
} else {  
throw new com.exalate.api.exception.IssueTrackerException(issueType + " cannot be created: Epic issue with remote id " + replica.epicId + " was not found. Please make sure the epic issue is synchronized before resolving this error" )  
}  
}

* * *

#### Comments:

> **Francis Martens (Exalate) commented on 19 June 2020**
>
> > Ha - I didn’t review if epicid is available. Need to find time to review

---

<div class="post-metadata">

### Author: ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)
#### Post date: [November 4, 2024, 6:42am UTC](https://community.exalate.com/t/check-if-epic-is-already-synced-in-the-local-system/4260/3 "2024-11-04T06:42:47Z")

</div>

_Answer by Francis Martens (Exalate) on 19 June 2020_

Hi Ziad Qadora

It is identical, but then you need to test with the epic id

Did you try the [epic sync external script](https://docs.idalko.com/exalate/pages/viewpage.action?pageId=42631412)

It should also cover this case.

* * *
