Help with formatting text in sync between ADO and Jira Cloud

Redirected from Exalate Support on behalf of Hanne. Asking the customer to upload the scripts:

We have set up a new Exalate connection between our Jira Cloud
("version":"1001.0.0-SNAPSHOT","versionNumbers":[1001,0,0],"deploymentType":"Cloud","buildNumber":100290)
and our customer’s ADO (Cloud v5.28.4, Core v5.28.4). The Jira Cloud projects are company-managed, and we are using Exalate version 4.1.19-AC.

We are experiencing issues with text formatting and the handling of attachments/pictures in comments and other fields. He suggested that I upload our scripts for review.

We would greatly appreciate your assistance with this.

It sounds like you’re running into common formatting challenges when syncing text, images, and attachments between Jira Cloud and Azure DevOps (ADO) using Exalate. This is due to Jira Cloud using Markdown and ADO using HTML, which can cause formatting issues for text, images, and comments. Here’s how you can address these issues in your sync scripts:

1. Text Formatting (Markdown ↔ HTML):

  • On the Jira Cloud side, you should convert Markdown to HTML when sending data, and convert HTML back to Markdown when receiving data.
  • Example for the Jira Cloud Outgoing Sync (to ADO):
    replica.description = nodeHelper.getHtmlField(issue, "description")
    replica.comments = nodeHelper.getHtmlComments(issue)
    
  • Example for the Jira Cloud Incoming Sync (from ADO):
    issue.description  = nodeHelper.toMarkDownFromHtml(replica.description)
    issue.comments     = nodeHelper.toMarkDownComments(commentHelper.mergeComments(issue, replica))
    
  • This approach helps maintain formatting for text, images, lists, tables, and links.
  • Full details: How to Convert Data between HTML and Markdown in Jira Cloud

2. Attachments and Images:

  • To sync attachments, use the following in your Outgoing Sync:
    replica.attachments = issue.attachments
    
  • And in your Incoming Sync:
    issue.attachments = attachmentHelper.mergeAttachments(issue, replica)
    
  • You can filter or customize which attachments to sync (e.g., by file type or only those mentioned in comments).
  • More info: How to Sync Attachments in Jira Cloud

3. Comments:

  • For syncing comments, the default is to merge local and remote comments:
    issue.comments = commentHelper.mergeComments(issue, replica)
    
  • You can also filter or format comments as needed.
  • More info: How to Sync Comments in Jira Cloud

What to do next:

  • Review your current sync scripts and compare them with the examples above.
  • Make sure you’re using the conversion helpers for text formatting and the merge helpers for attachments and comments.
  • If you’re still seeing issues, feel free to share your current scripts (as suggested by support) for a more targeted review.

These adjustments should help resolve most formatting and attachment issues between Jira Cloud and ADO.

Hi, as far as I can see, Jira Cloud (company managed) uses ADF-rendering, not classic wiki. This complicates it. toMarkDownFromHtml doesn’t work.

Hi @Hanne ,

Thank you for sharing further details. I will work on this and update you back with a solution by tomorrow.

Kind regards,
Ashar

Hi @Hanne ,

Sorry for taking longer time than anticipated.

I’ve almost got the solution, and only inline image part is pending for ‘Repro steps’ field. I am currently working on this, and will share the solution soon.

In the meanwhile, could you please try this out?

Outgoing - Jira cloud:

replica.description = nodeHelper.getHtmlField(issue, “description”)
replica.comments = nodeHelper.getHtmlComments(issue)

Incoming - ADO:

workItem.summary      = replica.summary
// Map description to ReproSteps if Bug, else to description
if(workItem.typeName == "Bug") {
  workItem."Microsoft.VSTS.TCM.ReproSteps" = replica.description
} else {
  workItem.description = replica.description
}
workItem.attachments = attachmentHelper.mergeAttachments(workItem, replica)
workItem.comments = commentHelper.mergeComments(workItem, replica)

It should work for the text formatting in ‘Repro steps’ field, and text formatting as well as inline image in Comments on the ADO side.

I’ve followed this documentation: How to Convert Data between HTML and Markdown in Jira

Kind regards,
Ashar

@ashar.iqbal

Did you test this with ADF-rendering field as well?

Thanks,

Sonal

Hi @ashar.iqbal,
thanks for your response. We’ve managed to work around the issues with importing text and images from Jira to ADO, but we’re still experiencing problems when importing into Jira.
Thanks,
Hanne

Hi @Hanne ,

I am glad to know that you managed to workaround from Jira to ADO. Would you like to share the solution that has worked for you?

And may I please have some details about ‘problem’ you’re particularly experiencing when importing from ADO to Jira?

Looking at the Local replica and Remote replica from Jira and the code snippet would be helpful. You can copy it from ‘Entity Sync Status’ tab.

Kind regards,

Ashar

Hello @Hanne ,

Just checking in to see if you had a chance to gather the replicas and details I requested earlier?

Thank you,

Ashar

Hope you’re doing well, @Hanne . If you still require assistance, please share the previously requested details so we can proceed with the remaining part of the use case (from ADO to Jira).

Thank you,

Ashar