ScriptRunner Cloud - Copy Asset Text Area field to an Issue description as Jira Wiki Markup

Luka Urushadze February 28, 2025

Hi everyone,

I have a ScriptRunner Script which is creating issues based on assets. My problem is that the asset text area field is formatted as an HTML:CleanShot 2025-02-28 at 17.56.38.png

Therefore they're also being copied to Issue Descriptions as HTML text without formatting, instead of Jira Wiki Markup.

I need to convert these from HTML to Jira Wiki Markup within this ScriptRunner Cloud script, but I couldn't find a way to do that.

Anyone has done this so far?

Thanks in advance!

2 answers

Suggest an answer

Log in or Sign up to answer
0 votes
Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 3, 2025

Hi Luka,

Unfortunately, Atlassian does not provide a Rest API in Jira Cloud to parse an HTML string into Jira Wiki Markup format.

However, if you know what valid Wiki Markup you need to convert to, you could use the XMLSlurper library provided by Groovy to parse the string and return a new structure using ScriptRunner for Jira Cloud.

I have created a simple example here which will parse the contents of a string containing a list like yours and convert this to a bulleted list in Jira Wiki Markup.

Using this approach, you could parse the value returned from Assets into the correct format before setting it in the issue description.

I hope this helps.

Regards,

Kristian

0 votes
Nikolai Ruban February 28, 2025

Hi Luka,

take a look at converter "WysiwygConverter.convertXHtmlToWikiMarkup"

see Documentation: https://developer.atlassian.com/server/confluence/html-to-markup-conversion-for-the-rich-text-editor/

 

Usage How To:

import com.atlassian.renderer.wysiwyg.converter.DefaultWysiwygConverter;

String fromInsight = "<p><strong>Population</strong></p><ul><li>2021 estimate:&nbsp;<strong>45,605,826</strong></li></ul><p><strong>Area</strong></p><ul><li>Total:&nbsp;<strong>2,780,400&nbsp;km2</strong></li></ul><p>&nbsp;</p>"
DefaultWysiwygConverter defaultWysiwygConverter = new DefaultWysiwygConverter()

String wikiMarkup = defaultWysiwygConverter.convertXHtmlToWikiMarkup(fromInsight);


I found it here: https://community.atlassian.com/t5/App-Central-questions/Convert-HTML-tags-in-description-field-when-copying-from-Insight/qaq-p/1805629

 

hope this helps

 

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events