Hey Brother and Sisters,
topic very old and looks like never resolved formally.
I am reffering to this
https://appfire.atlassian.net/wiki/spaces/JMCF/pages/465502588/Calculated+scripted+Text+Html+custom+field+type
Already saw atlassian doesnt want to support HTML because of secuirty. I am fine with this.
But is it true that we can create Custom Scripted Field and make it HTML-friendly?
If yes...any hints what to provide in groovy line?
The goal here is...I have System Field Description in my tickets and they have RAW HTML many (span) tags. Want to keep it that way in Description field but replicate the content and put in custom field SOCDescription where HTML is supported. Is it do-able...?
Hello @Mateusz Janus
Yes, this is doable in ScriptRunner, but I wouldn't use the old HTML template for it.
Just to clarify: that Appfire page covers JMCF, not ScriptRunner. In current ScriptRunner for Jira Data Center, the HTML template is deprecated and behaves the same as Text Field. Adaptavist's current examples that render HTML use Text Field (multi-line) and build output with MarkupBuilder.
For a quick test, try a scripted field with Text Field (multi-line) and simply return:
```
```
If your Description already contains literal HTML, that will tell you quickly whether it renders as expected in your environment.
That said, I'd be cautious with re-outputting raw HTML from Description. Atlassian disables HTML rendering by default due to XSS risk, and Adaptavist's safer pattern is to build only the markup you actually need with MarkupBuilder rather than blindly re-outputting arbitrary HTML.
Also worth considering: if your real goal is a persistent mirrored field, a scripted field is probably the wrong tool. It's a calculated/display field that recalculates on reindex, not a stored value. For a real stored copy, you'd be better off with a normal custom field kept in sync via a ScriptRunner Listener or Job.
thanks for quick reply. What I need from end user perspective, clear description field without HTML TAGS. So even automation will help if its do-able.
Whenever issue is created take original description and put in Custom Field ABC123 without <SPAN>s. But No idea where should i find a solution, either trying with HTML (cause i Can turn it ON in my JIRA admin settings) or with script runner or automation :/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As mentioned by @Arkadiusz Wroblewski
Scriptrunner does not support this.
This as HTML is considered a risk based on XSS (cross scripting risk). Atlassian warns to not do this,If you want to do this, it's at your own risk.
This is why app vendors also removed this or not support this anymore.
See this KB; https://confluence.atlassian.com/jirakb/enable-html-tag-usage-in-jira-data-center-text-fields-771895067.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thank you @Marc -Devoteam- as always helpful.
I found this https://support.atlassian.com/jira/kb/removing-html-formatting-in-the-jira-issue-descriptions-from-jeditor/
I guess i can try re-use it to clean HTML tags. I just need to ensure that i am removing HTML tags only but no one qill gurantee me this right...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
just for the future references if anyone need help with this entire HTML
1. I created automation which COPY Original Description to Another custom field called "Description2" - just for backup and to support user experience. Entire time ticket history log keeps all records and updates.
2. Then i used this automation with action from above comment to remove HTML tags. Works really nice.
{{issue.description.replaceAll("</?((b|br|div|div class=.*|div style=.*|i|li|ol|p|span|span class=.*|span style=.*|strong|sub|sup|table|tbody|td|th|tr|ul| ))>","")}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yep here you behaving in Ground of "Try and Test".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.