-
Suggestion
-
Resolution: Unresolved
-
None
-
8
-
8
-
Issue description
The value of a Textarea type attribute is stored in HTML format. There's no way to change the format to plain text and no alternative if we want to use a multi-line text field
Suggestion
A plain text Textarea attribute or feature to disable HTML
Use case
The value of a Textarea attribute is copied to a Jira field. The copied values have HTML tags that do not mean anything in a Jira field that uses Wiki markup.
Workaround
- Use Insight post function with groovy script to remove all HTML tags and put the resulting text into a Single Line text custom field. An example script can be found in this comment:
- Use the Insight post function with a Groovy script to remove all HTML tags and put the resulting text into a Single Line text custom field. An example script can be found in this comment:
Use the Insight Groovy Script postfunction and use the script below.
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.fields.CustomField import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.event.type.EventDispatchOption import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade import com.riadalabs.jira.plugins.insight.services.model.ObjectAttributeBean import com.riadalabs.jira.plugins.insight.services.model.ObjectBean Class objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade"); def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectFacadeClass); List<ObjectBean> insightObjects = issue.getCustomFieldValue(ComponentAccessor.getCustomFieldManager().getCustomFieldObject(10107)); // Change ID (10107) to the correct Insight Customfield id ObjectAttributeBean textAreaValue = objectFacade.loadObjectAttributeBean(insightObjects.first().getId(), "Text Area Attribute") //Change "Text Area Attribute" with the name of the Text Are attribute you wish to use String textAreaHtmlValue = textAreaValue.objectAttributeValueBeans.first().textValue String nohtml = textAreaHtmlValue.replaceAll("\\<.*?>"," "); def singleTextCf = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(11000) // Change ID (11000) to the correct Text Customfield MutableIssue mi = (MutableIssue) issue; mi.setCustomFieldValue(singleTextCf, nohtml); ComponentAccessor.getIssueManager().updateIssue(currentUser, mi, EventDispatchOption.DO_NOT_DISPATCH, false); return true
You will need to adjust the script as commented in it:
- Change ID (10107) to the correct Insight Customfield id'
- Change "Text Area Attribute" with the name of the Text Are attribute you wish to use
- Change ID (11000) to the correct Text Customfield
The Script will look at the Object selected in your Insight CF, get the TextArea Attribute content (identified by the Attribute Name) - remove all HTML Tags, and put the resulting text into the Single Line Text CF.
- Use the Insight post function with a Groovy script to remove all HTML tags and put the resulting text into a Single Line text custom field. An example script can be found in this comment:
- links to
[JSDSERVER-7185] Plain text Textarea attribute
UIS | Original: 10 | New: 8 |
UIS | Original: 4 | New: 10 |
Support reference count | Original: 7 | New: 8 |
UIS | Original: 3 | New: 4 |
Support reference count | New: 7 |
UIS | Original: 2 | New: 3 |
Description |
Original:
h3. Issue description
The value of a Textarea type attribute is stored in HTML format. There's no way to change the format to plain text and no alternative if we want to use a multi-line text field h3. Suggestion A plain text Textarea attribute or feature to disable HTML h3. Use case The value of a Textarea attribute is copied to a Jira field. The copied values have HTML tags that do not mean anything in a Jira field that uses Wiki markup. h3. Workaround * Use Insight post function with groovy script to remove all HTML tags and put the resulting text into a Single Line text custom field. An example script can be found in [this comment|https://jira.mindville.com/browse/ICS-1190] |
New:
h3. Issue description
The value of a Textarea type attribute is stored in HTML format. There's no way to change the format to plain text and no alternative if we want to use a multi-line text field h3. Suggestion A plain text Textarea attribute or feature to disable HTML h3. Use case The value of a Textarea attribute is copied to a Jira field. The copied values have HTML tags that do not mean anything in a Jira field that uses Wiki markup. h3. Workaround * Use Insight post function with groovy script to remove all HTML tags and put the resulting text into a Single Line text custom field. An example script can be found in [this comment|https://jira.mindville.com/browse/ICS-1190]: {panel} * Use the Insight post function with a Groovy script to remove all HTML tags and put the resulting text into a Single Line text custom field. An example script can be found in [this comment|https://jira.mindville.com/browse/ICS-1190]: {quote}Use the Insight Groovy Script postfunction and use the script below. {noformat} import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.fields.CustomField import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.event.type.EventDispatchOption import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade import com.riadalabs.jira.plugins.insight.services.model.ObjectAttributeBean import com.riadalabs.jira.plugins.insight.services.model.ObjectBean Class objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade"); def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectFacadeClass); List<ObjectBean> insightObjects = issue.getCustomFieldValue(ComponentAccessor.getCustomFieldManager().getCustomFieldObject(10107)); // Change ID (10107) to the correct Insight Customfield id ObjectAttributeBean textAreaValue = objectFacade.loadObjectAttributeBean(insightObjects.first().getId(), "Text Area Attribute") //Change "Text Area Attribute" with the name of the Text Are attribute you wish to use String textAreaHtmlValue = textAreaValue.objectAttributeValueBeans.first().textValue String nohtml = textAreaHtmlValue.replaceAll("\\<.*?>"," "); def singleTextCf = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(11000) // Change ID (11000) to the correct Text Customfield MutableIssue mi = (MutableIssue) issue; mi.setCustomFieldValue(singleTextCf, nohtml); ComponentAccessor.getIssueManager().updateIssue(currentUser, mi, EventDispatchOption.DO_NOT_DISPATCH, false); return true {noformat} You will need to adjust the script as commented in it: * Change ID (10107) to the correct Insight Customfield id' * Change "Text Area Attribute" with the name of the Text Are attribute you wish to use * Change ID (11000) to the correct Text Customfield The Script will look at the Object selected in your Insight CF, get the TextArea Attribute content (identified by the Attribute Name) - remove all HTML Tags, and put the resulting text into the Single Line Text CF. {quote}{panel} |
UIS | Original: 1 | New: 2 |
Labels | New: ril |
Remote Link | New: This issue links to "Internal ticket (Web Link)" [ 976954 ] |