Hi,
I made a script that make a template value in custom field (type text multi).
I would like to bold some of the lines.. but without success..
How can I do it? * didn't work and <b> didn't work too.
This is my script:
import com.atlassian.jira.component.ComponentAccessor
//def summary = getFieldById("summary").value
//String summaryCAR = summary.toString().substring(0,3);
def desc = getFieldById("customfield_XXXXX")
def defaultValue = """bla bla bla bla bla bla
*bla bla bla*
bla bla bla
<b>bla bla bla</b>
""".replaceAll(/ /, '')
if (! underlyingIssue?.description)
{
desc.setFormValue(defaultValue)
}
Check the Visual/Text editor type on the issue creation form just in case)
That's correct. And should work:
*bla bla bla*
The visual editor should have bold text. The text editor should be marked with asterisks.
To check the type of the editor for custom fields: https://community.atlassian.com/t5/Jira-questions/Which-custom-field-type-uses-Jira-markup/qaq-p/312162
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks! @Maksim Smetannikov :)
I worked, but only in create screen.
I would like it to work on edit screen too...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It should be simple:
if (!underlyingIssue?.getCustomFieldValue(ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_XXXXX")))
{
desc.setFormValue(defaultValue)
}
If I understand you correctly :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Maksim Smetannikov , Unfortunately , This template is still showing only in create screen and not in view\edit screen..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I corrected the previous comment-it works on edit screen.
How do you expect this to work on the view screen? After all, the default behavior of jira: do not display empty fields on the view screen. :(
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Maksim Smetannikov You right, I meant only edit screen... Still not working with you updated answer..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Maksim Smetannikov I found out that when I'm opening the edit screen, the template didn't shown, But when I click on 'Visual' It is shown.. What happened there?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Perhaps you have missed some small detail. Here is your code with my changes and it works on edit screen:
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.