Hey,
I want to copy the content of an Insight Textarea Attribute to a jira custom field.
I do this with an Insight Postfunction “Set a Jira custom field with the attribute value from a selected object”
The content is copied, but the formatting is not correct. It looks like HTML-code is being copied.
How do I make sure that the text in the jira field is displayed the same as in the Insight object?
I am now using a jira multi text field with wiki rendering.
Anyone tips, suggestions?
Thanks in advance.
Groetjes,
Greetings,
Marco
p.s. Attached a screenshot of the display in the jira field.
And a screenshot where you can see the display in Insight and the result in jira custom field
This is actually quite a huge issue.
I am facing to this and trying to solve that last few months.
Got official Atlassian reply - it is not supported.
There are two or three workarounds.
First is to strip all HTML tags and receive a plain text - use
textToStrip.replaceAll("\\<.*?>"," ");
Second approach is to create translation library - own method to convert html tags to wiki markup tags.
The last approach I dug somewhere deep in community is to use
com.atlassian.renderer.wysiwyg.converter.DefaultWysiwygConverter
class from the atlassian-renderer library and call convertXHtmlToWikiMarkup method for the object.
I am planning to go with last one, but had no time to proof it is working yet.
Hope it helped, let me know in case of success. Facing very same issue.
Cheers, Tom, Czechia
Yes, I made it, I planned to write an article about this conversion, but kind of forget about it.
Well main reason is that the I left the company I worked on that particular project, so I have no more access to working environment with this conversion mechanism.
But, as far as I remember, it was delivered in Adaptavist Script Runner Behaviour plugin using wysiwyg converter.
You can actually dig into https://docs.atlassian.com/atlassian-renderer/5.0/apidocs/com/atlassian/renderer/wysiwyg/converter/DefaultWysiwygConverter.html and use methods convertXHtmlToWikiMarkup and convertWikiMarkupToXHtml depends on what you are trying to achieve.
Will try to dig into my code backups, but not sure if I will be lucky.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I founded a way Insight -> Jira for Behaviours
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
Class iqlFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.IQLFacade")
def iqlFacade = ComponentAccessor.getOSGiComponentInstanceOfType(iqlFacadeClass)
Class objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade")
def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectFacadeClass)
int implementationPlanId = 1927
String searchString = "Key"
String html = "{html}"
def catalogItem = getFieldById(getFieldChanged()).getValue().toString()
def catalogItemObject = iqlFacade.findObjectsByIQLAndSchema(1, "\"" + searchString + "\" = \"" + catalogItem + "\"")
def catalogItemId = catalogItemObject[0].getId()
def implementationPlan = objectFacade.loadObjectAttributeBean(catalogItemId, implementationPlanId)
if( implementationPlan )
{
def objectAttributeValues = implementationPlan.getObjectAttributeValueBeans()
def objectAttributeValue = objectAttributeValues[0]
implementationPlan = html+objectAttributeValue.getValue()+html
}
getFieldByName("Implementation plan").setReadOnly(true).setFormValue(implementationPlan)
This part of code actually took content of 1927 Insight attribute formatted text and prefilled it inside the "Implementation Plan" custom field within the screen.
Hope it help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My first suggestion would have been to update the field configuration to ensure it's a wiki rendering, but you have done that already.
Have you tried clearing the formatting on the insight object attribute? Copy and paste it to notepad.
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.