Originally asked by Sahil Yadav on 02 February 2024 (original question)
Hi Team,
We have a custom script which simulates Exalate “Connect” operation as below during first sync.
Scenario Flow (Customer Jira to Our Jira):
- User creates a Feature manually in our Jira.
- Customer user creates feature manually in their Jira providing a label with our Feature key created in Step-1.
- With the help of our feature key mentioned in Customer Jira, while establishing first sync, we are using below small custom script:
Script snippet
if (firstSync) {
if(replica.typeName == “Feature”){
connectFeatureToFeature()
}
}
void connectFeatureToFeature() {
String projectKey = issue.getProjectKey()
final String INTERNAL_KEY_REGEX = “^${projectKey}-\\d+”
Issue jiraSyncedIssue = ComponentAccessor.getIssueManager().getIssueObject(issue.getKey())
IHubLabel label = getLabelOfIssueKeyPerRegex(jiraSyncedIssue, INTERNAL_KEY_REGEX)
if (label) {
String issueKey = label.getLabel()
Issue jiraIssue = ComponentAccessor.getIssueManager().getIssueObject(issueKey) if(jiraIssue){
[issue.id](http://issue.id) = jiraIssue.getId() as Long
}
}
}
The major problem we are facing in this situation is:
We are able to successfully connect Customer Feature to our exiting Feature by script, but whatever Attachments and Comments were previously added by our user during Feature creation are getting deleted/removed during first sync only.
Incoming script line used for syncing comments as below:
issue.comments = commentHelper.mergeComments(issue, replica)
and we do not have any incoming script for syncing attachments so we were expecting that our side attachments should remain as it is.
Note: All other system fields and customfield values remain as it is and it is working as expected.
So, could you please suggest on how to resolve issue only for attachments and comments?